imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 15:30:59 +0300
branchRCL_3
changeset 21 6257223ede8a
parent 20 2b4b06654caa
child 22 9d4d3445ce6e
permissions -rw-r--r--
Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
2014ca87e772 Revision: 201004
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). 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
2014ca87e772 Revision: 201004
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".
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  Thumbnail server
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
 *
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <e32svr.h>
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
    20
#include <MIHLScaler.h>
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <driveinfo.h>
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <caf/data.h>
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
    23
#include <Oma2Agent.h>
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <bautils.h>  
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <mdesession.h>
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include "thumbnailserver.h"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include "thumbnailtaskprocessor.h"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include "thumbnailserversession.h"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include "thumbnailmanagerconstants.h"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include "thumbnailmanageruids.hrh"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "thumbnaillog.h"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include "thumbnailstore.h"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include "thumbnaildiskunmountobserver.h"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include "thumbnailpanic.h"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include "thumbnailcenrep.h"
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include "thumbnailmemorycardobserver.h"
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    38
#include "tmgetimei.h"
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
    39
#include "thumbnailfetchedchecker.h"
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    40
#include "OstTraceDefinitions.h"
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    41
#ifdef OST_TRACE_COMPILER_IN_USE
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    42
#include "thumbnailserverTraces.h"
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    43
#endif
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    44
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
_LIT8( KThumbnailMimeWildCard, "*" );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
_LIT8( KThumbnailMimeImage, "image" );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
_LIT8( KThumbnailMimeVideo, "video" );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
_LIT8( KThumbnailMimeAudio, "audio" );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    51
_LIT8( KThumbnailMimeContact, "contact" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
const TChar KThumbnailMimeSeparatorChar = '/';
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
const TChar KThumbnailMimeWildCardChar = '*';
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
const TChar KThumbnailMimeTypeSeparatorChar = ' ';
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
// ----------------------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
// Server's policy here
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
// ----------------------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
// ----------------------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
// Total number of ranges
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
// ----------------------------------------------------------------------------------------
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
    64
const TUint KThumbnailServerRangeCount = 16;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
// ----------------------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
// Definition of the ranges
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
// ----------------------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
const TInt KThumbnailServerRanges[KThumbnailServerRangeCount] = 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
{
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    ERequestThumbByPathAsync,      
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
    ERequestThumbByFileHandleAsync,          
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    EReleaseBitmap,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
    ECancelRequest,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
    EChangePriority,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
    EDeleteThumbnails,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
    EGetMimeTypeBufferSize,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
    EGetMimeTypeList,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
    ERequestThumbByIdAsync,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    ERequestThumbByBufferAsync,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    ERequestSetThumbnailByBuffer,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    EDeleteThumbnailsById,
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
    83
    ERenameThumbnails,
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
    EUpdateThumbnails,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
    ERequestSetThumbnailByBitmap,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
    EThumbnailServerRequestCount,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
};
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
// ----------------------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
// Policy to implement for each of the above ranges 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
// ----------------------------------------------------------------------------------------      
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
const TUint8 KThumbnailServerElementsIndex[KThumbnailServerRangeCount] = 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    CPolicyServer::ECustomCheck,    // ERequestThumbByPathAsync
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    CPolicyServer::ECustomCheck,    // ERequestThumbByFileHandleAsync
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
    CPolicyServer::ECustomCheck,    // EReleaseBitmap
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
    CPolicyServer::ECustomCheck,    // ECancelRequest
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
    CPolicyServer::ECustomCheck,    // EChangePriority
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
    CPolicyServer::ECustomCheck,    // EDeleteThumbnails
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
    CPolicyServer::ECustomCheck,    // EGetMimeTypeBufferSize
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
    CPolicyServer::ECustomCheck,    // EGetMimeTypeList
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
    CPolicyServer::ECustomCheck,    // ERequestThumbByIdAsync
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
    CPolicyServer::ECustomCheck,    // ERequestThumbByBufferAsync
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    CPolicyServer::ECustomCheck,    // ERequestSetThumbnailByBuffer
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    CPolicyServer::ECustomCheck,    // EDeleteThumbnailsById
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   106
    CPolicyServer::ECustomCheck,    // ERenameThumbnails
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    CPolicyServer::ECustomCheck,    // EUpdateThumbnails
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    CPolicyServer::ECustomCheck,    // ERequestSetThumbnailByBitmap
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
    CPolicyServer::ECustomCheck,    // EThumbnailServerRequestCount
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
    };
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
// ----------------------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
// Package all the above together into a policy 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
// ---------------------------------------------------------------------------------------- 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
const CPolicyServer::TPolicy KThumbnailServerPolicy =
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
    CPolicyServer::EAlwaysPass,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
    KThumbnailServerRangeCount,      // number of ranges
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    KThumbnailServerRanges,          // ranges array
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    KThumbnailServerElementsIndex,   // elements<->ranges index
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
    NULL 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
                               // array of elements
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
    };
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
// CustomSecurityCheckL
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
CPolicyServer::TCustomResult CThumbnailServer::CustomSecurityCheckL(
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
        const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/ )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
    CPolicyServer::TCustomResult securityCheckResult = EFail;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
    switch ( aMsg.Function() )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
        case ERequestThumbByPathAsync:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
        case ERequestThumbByFileHandleAsync:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
        case ERequestThumbByIdAsync:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
        case ERequestThumbByBufferAsync:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
            securityCheckResult = EPass;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
            break;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
        case EReleaseBitmap:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
        case ECancelRequest:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
        case EChangePriority:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
        case EDeleteThumbnails:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
        case EGetMimeTypeBufferSize:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
        case EGetMimeTypeList:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
        case ERequestSetThumbnailByBuffer:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
        case EDeleteThumbnailsById:
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   152
        case EUpdateThumbnails:
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   153
        case ERenameThumbnails:    
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
        case ERequestSetThumbnailByBitmap:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
            if( aMsg.HasCapability( ECapabilityReadDeviceData ) && 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
                aMsg.HasCapability( ECapabilityWriteDeviceData ) )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
                {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
                securityCheckResult = EPass;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
                }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
            break;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
        case EThumbnailServerRequestCount:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
        default:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
            securityCheckResult = EFail;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
    return securityCheckResult;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
// CustomFailureActionL
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
CPolicyServer::TCustomResult CThumbnailServer::CustomFailureActionL(
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
        const RMessage2& /*aMsg*/, TInt /*aAction*/, const TSecurityInfo& /*aMissing*/ )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
    // Not used
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
    return EFail;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
// ======== MEMBER FUNCTIONS ========
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
// CThumbnailServer::CThumbnailServer()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
// C++ default constructor can NOT contain any code, that might leave.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
CThumbnailServer::CThumbnailServer(): CPolicyServer( CActive::EPriorityStandard,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
    KThumbnailServerPolicy, EUnsharableSessions )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
    // No implementation required
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
// CThumbnailServer::NewL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
// Two-phased constructor.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
CThumbnailServer* CThumbnailServer::NewL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
    CThumbnailServer* self = new( ELeave )CThumbnailServer();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
    CleanupStack::PushL( self );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
    self->ConstructL();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
    CleanupStack::Pop( self );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
    return self;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
// CThumbnailServer::ConstructL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
// Symbian 2nd phase constructor can leave.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
void CThumbnailServer::ConstructL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
    TN_DEBUG1( "CThumbnailServer::ConstructL()" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   219
    OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_CONSTRUCTL, "CThumbnailServer::ConstructL" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
#ifdef _DEBUG
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
    iPlaceholderCounter = 0;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
#endif
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
    // create shutdown observer
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
    iShutdownObserver = CTMShutdownObserver::NewL( *this, KTMPSNotification, KShutdown, ETrue );  
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
    iShutdown = EFalse;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
    
9
dea39715fc05 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   229
    // MDS session reconnect timer
dea39715fc05 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   230
    iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
dea39715fc05 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   231
    
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
    // connect to MDS
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
    iMdESession = CMdESession::NewL( *this );
14
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   234
    iSessionError = EFalse;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
    User::LeaveIfError( iFbsSession.Connect());
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
    User::LeaveIfError( Start( KThumbnailServerName ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
    User::LeaveIfError( iFs.Connect());
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
    iProcessor = CThumbnailTaskProcessor::NewL();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
    REComSession::FinalClose();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
    REComSession::ListImplementationsL( TUid::Uid( THUMBNAIL_PROVIDER_IF_UID ),
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
        iPluginInfoArray );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
    
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   244
	//preload provide plugins
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   245
    PreLoadProviders();
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   246
    
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   247
    CTMGetImei * imeiGetter = CTMGetImei::NewLC();
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
   
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   249
    iImei = imeiGetter->GetIMEI();
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   250
    CleanupStack::PopAndDestroy(imeiGetter);
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
    iFs.CreatePrivatePath(EDriveC);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
    iFs.SetSessionToPrivate(EDriveC);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
    iCenrep = CThumbnailCenRep::NewL();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
               
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
    iPersistentSizes = iCenrep->GetPersistentSizes();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
            
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
    iMMCObserver = CThumbnailMemoryCardObserver::NewL( this, iFs );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
    
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   261
    iFormatObserver = CTMFormatObserver::NewL( *this );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
    iFormatting = EFalse;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
    
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   265
    OpenStoresL();
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
    AddUnmountObserversL();
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   268
    iFetchedChecker = CThumbnailFetchedChecker::NewL();
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   269
    
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   270
    // Unmount timeout timer
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   271
    iUnmount = CPeriodic::NewL(CActive::EPriorityIdle);
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
// Destructor.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
CThumbnailServer::~CThumbnailServer()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
    TN_DEBUG1( "CThumbnailServer::~CThumbnailServer()" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   282
    OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_CTHUMBNAILSERVER, "CThumbnailServer::~CThumbnailServer" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
    iShutdown = ETrue;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
    
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   286
    if(iUnmount)
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   287
        {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   288
        iUnmount->Cancel();
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   289
        delete iUnmount;
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   290
        iUnmount = NULL;
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   291
        }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   292
		
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   293
	iUnmountedDrives.Close();
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   294
    
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   295
    delete iFetchedChecker;
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   296
    iFetchedChecker = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
    delete iShutdownObserver;
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   298
    iShutdownObserver = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
    delete iProcessor;
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   300
    iProcessor = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
    
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   302
    if(iReconnect)
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   303
        {
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   304
        iReconnect->Cancel();
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   305
        delete iReconnect;
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   306
        iReconnect = NULL;
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   307
        }
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   308
    
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
    if (iMdESession)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   311
        delete iMdESession;
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   312
        iMdESession = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   313
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
    ResetAndDestroyHashMap < TInt, CThumbnailStore > ( iStores );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
    ResetAndDestroyHashMap < TInt32, CThumbnailProvider > ( iProviders );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   317
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
    iUnmountObservers.ResetAndDestroy();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
    delete iMMCObserver;
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   320
    iMMCObserver = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
    delete iFormatObserver;
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   322
    iFormatObserver = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   324
    THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
    // const pointer to a non-const object
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
    const TThumbnailBitmapRef* ref = bpiter.NextValue();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
    while ( ref )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
        delete ref->iBitmap;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
        ref = bpiter.NextValue();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   333
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   335
    delete iScaler;
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   336
    iScaler = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
    iBitmapPool.Close();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
    iFbsSession.Disconnect();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
    iRecognizer.Close();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
    iPluginInfoArray.ResetAndDestroy();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
    delete iCenrep;
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   342
    iCenrep = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
    iFs.Close();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
    REComSession::FinalClose();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
// CThumbnailServer::HandleSessionOpened
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
//
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   351
#ifdef _DEBUG
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   352
void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   353
#else
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt /*aError*/ )
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   355
#endif
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
    {
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   357
#ifdef _DEBUG
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   358
    TN_DEBUG2( "CThumbnailServer::HandleSessionOpened error == %d", aError );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   359
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_HANDLESESSIONOPENED, "CThumbnailServer::HandleSessionOpened;aError=%d", aError );
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   360
#endif    
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
// CThumbnailServer::HandleSessionError
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
void CThumbnailServer::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
    {
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   369
    TN_DEBUG2( "CThumbnailServer::HandleSessionError == %d", aError );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   370
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_HANDLESESSIONERROR, "CThumbnailServer::HandleSessionError;aError=%d", aError );
14
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   371
    if (aError != KErrNone && !iShutdown && !iSessionError)
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
        {
14
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   373
        iSessionError = ETrue;
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   374
    
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   375
        if (!iReconnect->IsActive())
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   376
            {
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   377
            iReconnect->Start( KMdEReconnect, KMdEReconnect, 
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   378
                               TCallBack(ReconnectCallBack, this));
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   379
            
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   380
            TN_DEBUG1( "CThumbnailServer::HandleSessionError() - reconnect timer started" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   381
            OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_HANDLESESSIONERROR, "CThumbnailServer::HandleSessionError - reconnect timer started" );
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   382
            }
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   383
        } 
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   384
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   385
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   386
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   387
// CThumbnailServer::NewSessionL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   388
// Creates new server session.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   390
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   391
CSession2* CThumbnailServer::NewSessionL( const TVersion& aVersion, const
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   392
    RMessage2&  /*aMessage*/ )const
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   393
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   394
    const TVersion v( KThumbnailServerMajorVersionNumber,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   395
        KThumbnailServerMinorVersionNumber, KThumbnailServerBuildVersionNumber )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   396
        ;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   397
    if ( !User::QueryVersionSupported( v, aVersion ))
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
        User::Leave( KErrNotSupported );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   401
    return new( ELeave )CThumbnailServerSession();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
// CThumbnailServer::ThreadFunctionL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
void CThumbnailServer::ThreadFunctionL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
    // Rename own thread
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
    User::LeaveIfError( User::RenameThread( KThumbnailServerName ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
    CThumbnailServer* server = NULL;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
    CActiveScheduler* scheduler = new( ELeave )CActiveScheduler();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   416
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
    if ( scheduler )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
        CActiveScheduler::Install( scheduler );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
        CleanupStack::PushL( scheduler );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
        server = CThumbnailServer::NewL(); // Adds server in scheduler
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
        // No need to CleanupStack::PushL(server) since no leaves can happen
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
        RProcess::Rendezvous( KErrNone );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
        TN_DEBUG1( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
            "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() in" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   426
        OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_THREADFUNCTIONL, "CThumbnailServer::ThreadFunctionL -- CActiveScheduler::Start() in" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
        CActiveScheduler::Start();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
        TN_DEBUG1( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
            "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   430
        OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_THREADFUNCTIONL, "CThumbnailServer::ThreadFunctionL - out" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
        // Comes here if server gets shut down
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
        delete server;
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   433
        server = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
        CleanupStack::PopAndDestroy( scheduler );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   437
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   438
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   439
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   440
// CThumbnailServer::AddSession()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   441
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
void CThumbnailServer::AddSession()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   444
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
    TN_DEBUG2( "CThumbnailServer::AddSession() iSessionCount was %d",
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
        iSessionCount );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   447
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_ADDSESSION, "CThumbnailServer::AddSession;iSessionCount=%d", iSessionCount );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
    iSessionCount++;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   451
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
// CThumbnailServer::DropSession()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   455
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   456
void CThumbnailServer::DropSession(CThumbnailServerSession* aSession)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
    TN_DEBUG2( "CThumbnailServer::DropSession() iSessionCount was %d",
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
        iSessionCount );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   460
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;iSessionCount=%d", iSessionCount );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
    iSessionCount--;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   462
    
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   463
    if(iProcessor)
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   464
        {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   465
        iProcessor->RemoveTasks(aSession);
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   466
        }
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   467
    
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   468
    TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );        
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   469
    OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;aSession=%o", aSession );
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   470
    
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   471
    // clean-up bitmap pool    
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   472
    THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   473
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   474
    // const pointer to a non-const object
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   475
    const TThumbnailBitmapRef* ref = bpiter.NextValue();
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   476
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   477
    while ( ref )
14
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   478
        {        
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   479
        if ( ref->iSession == aSession )
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   480
            {
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   481
            TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   482
            OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;ref->iSession=%o", ref->iSession );
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   483
        
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   484
            delete ref->iBitmap;
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   485
            bpiter.RemoveCurrent();
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   486
                        
14
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
   487
            TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   488
            OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;iBitmapPool.Count()=%d", iBitmapPool.Count() );
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   489
            }
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   490
        
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   491
        ref = bpiter.NextValue();        
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   492
        }
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   493
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
    if ( iSessionCount <= 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
        // server shutdown
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
        if (!iShutdown)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
            {
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   499
            // rename thread
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   500
            User::RenameThread( KThumbnailServerShutdown );
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   501
        
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
            CActiveScheduler::Stop();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   503
            iShutdown = ETrue;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   504
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   506
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   507
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   508
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
// CThumbnailServer::ShutdownNotification
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   510
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   511
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   512
void CThumbnailServer::ShutdownNotification()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   513
    {
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   514
    TN_DEBUG1( "CThumbnailServer::ShutdownNotification()");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   515
    OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_SHUTDOWNNOTIFICATION, "CThumbnailServer::ShutdownNotification" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   516
    if (!iShutdown)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   517
        {
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   518
        TN_DEBUG1( "CThumbnailServer::ShutdownNotification() shutdown");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   519
        OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_SHUTDOWNNOTIFICATION, "CThumbnailServer::ShutdownNotification - shutdown" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   520
        CActiveScheduler::Stop();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   521
        iShutdown = ETrue;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   522
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   523
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   524
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
// CThumbnailServer::AddBitmapToPoolL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
// Add bitmap to bitmap pool.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
void CThumbnailServer::AddBitmapToPoolL( CThumbnailServerSession* aSession,
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   532
    CFbsBitmap* aBitmap, TThumbnailServerRequestId aRequestId )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
    if( !aBitmap )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
        {
1
235a7fc86938 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   536
        TN_DEBUG1( "CThumbnailServer::AddBitmapToPoolL() - KErrArgument");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   537
        OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_ADDBITMAPTOPOOLL, "CThumbnailServer::AddBitmapToPoolL - KErrArgument" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   538
        User::Leave( KErrArgument );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   539
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   540
    TN_DEBUG4( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
        "CThumbnailServer::AddBitmapToPoolL(aSession=0x%08x, aBitmap=0x%08x), handle=%d", aSession, aBitmap, aBitmap->Handle());
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   542
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   543
    TThumbnailBitmapRef* ptr = iBitmapPool.Find( aBitmap->Handle());
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   544
8
7403edfcf0fb Revision: 201009
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 7
diff changeset
   545
    TN_DEBUG2( "CThumbnailServer::AddBitmapToPoolL() - req id = %d", aRequestId.iRequestId );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   546
    OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_ADDBITMAPTOPOOLL, "CThumbnailServer::AddBitmapToPoolL;aRequestId.iRequestId=%u", aRequestId.iRequestId );
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   547
    
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
    if ( ptr )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   549
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
        ptr->iRefCount++;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   551
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
    else
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   553
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   554
        TThumbnailBitmapRef ref;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
        ref.iBitmap = aBitmap;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   556
        ref.iSession = aSession;
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   557
        ref.iRefCount = 1; // magic: first reference        
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   558
        ref.iRequestId = aRequestId.iRequestId;               
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   559
        
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
        iBitmapPool.InsertL( aBitmap->Handle(), ref );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   562
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   563
#ifdef _DEBUG
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
    TN_DEBUG2( "CThumbnailServer::BITMAP-POOL-COUNTER----------, Bitmaps = %d", iBitmapPool.Count() );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   565
    OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_ADDBITMAPTOPOOLL, "CThumbnailServer::AddBitmapToPoolL;iBitmapPool.Count()=%d", iBitmapPool.Count() );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
#endif
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   567
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   568
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   569
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   570
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   571
// CThumbnailServer::StoreThumbnailL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   572
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   573
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   574
void CThumbnailServer::StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aBitmap,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   575
    const TSize& aOriginalSize, const TBool aCropped, const TThumbnailSize aThumbnailSize,
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   576
    const TInt64 aModified, const TBool aThumbFromPath, const TBool aCheckExist )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   577
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   578
    TN_DEBUG6( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   579
        "CThumbnailServer::StoreBitmapL(aPath=%S, aBitmap=0x%08x, aOriginalSize=%dx%d, aCropped=%d)", &aPath, aBitmap, aOriginalSize.iWidth, aOriginalSize.iHeight, aCropped );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   580
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aBitmap=%o", aBitmap );
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   581
    OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aPath=%S", aPath );
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   582
    OstTraceExt3( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aOriginalSize.iWidth=%d;aOriginalSize.iHeight=%d;aCropped=%u", aOriginalSize.iWidth, aOriginalSize.iHeight, aCropped );
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   583
    
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   584
#ifdef _DEBUG
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   585
    TN_DEBUG2( "CThumbnailServer::StoreThumbnailL() - iScaledBitmap displaymode is %d", aBitmap->DisplayMode());
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   586
    OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aBitmap->DisplayMode()=%u", aBitmap->DisplayMode() );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   587
#endif
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   588
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   589
    if (!aCheckExist)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   590
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   591
        StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   592
                       aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
        }    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
    else if(BaflUtils::FileExists( iFs, aPath))
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   595
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   596
        StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   597
                       aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   598
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   599
    else
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   600
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   601
        TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   602
        OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL - file doesn't exists anymore, skip store!" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   603
        }
13
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   604
    
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   605
    if( iFetchedChecker )    
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   606
        {
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   607
        iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, KErrNone );
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   608
        }
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   609
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   610
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   613
// CThumbnailServer::FetchThumbnailL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   614
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   616
void CThumbnailServer::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* &
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   617
    aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   618
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   619
    TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   620
    OstTraceExt2( TRACE_NORMAL, CTHUMBNAILSERVER_FETCHTHUMBNAILL, "CThumbnailServer::FetchThumbnailL;aPath=%S;aThumbnailSize=%hu", aPath, aThumbnailSize );
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   621
    if( iFetchedChecker )
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   622
        {
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   623
        TInt err( iFetchedChecker->LastFetchResult( aPath, aThumbnailSize ) );
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   624
        if ( err == KErrNone ) // To avoid useless sql gets that fails for sure
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   625
            {
13
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   626
            // custom sizes are not stored to db, skip fetching
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   627
            if ( aThumbnailSize == ECustomThumbnailSize )
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   628
                {
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   629
                User::Leave( KErrNotFound );
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   630
                }
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   631
        
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   632
            TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) );
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   633
            if ( err != KErrNone )
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   634
                {
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   635
                iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, err );
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   636
                }
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   637
            }
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   638
        User::LeaveIfError( err );
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   639
        }
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   640
    else
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   641
        {
13
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   642
        // custom sizes are not stored to db, skip fetching
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   643
        if ( aThumbnailSize == ECustomThumbnailSize )
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   644
            {
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   645
            User::Leave( KErrNotFound );
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   646
            }
ffb2d5dd62e9 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 11
diff changeset
   647
    
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   648
        StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize);
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   649
        }
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   653
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
// CThumbnailServer::DeleteBitmapFromPool()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
// Removes bitmap from bitmap pool
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
void CThumbnailServer::DeleteBitmapFromPool( TInt aHandle )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   660
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   661
    TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool(%d)", aHandle );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   662
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool;aHandle=%d", aHandle );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   663
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   664
    TThumbnailBitmapRef* ptr = iBitmapPool.Find( aHandle );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   665
    if ( ptr )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   666
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   667
        ptr->iRefCount--;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   668
        if ( !ptr->iRefCount )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   669
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   670
            TN_DEBUG3( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   671
                "CThumbnailServer::DeleteBitmapFromPool(%d) -- deleting 0x%08x)", aHandle, ptr );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   672
            OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool -- deleting;ptr=%o", ptr );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   673
            delete ptr->iBitmap;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   674
            ptr->iBitmap = NULL;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   675
            iBitmapPool.Remove( aHandle );
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   676
            TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool -- items left %d", iBitmapPool.Count() );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   677
            OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool  -- items left;iBitmapPool.Count()=%d", iBitmapPool.Count() );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   678
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   679
        else
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   680
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   681
            TN_DEBUG3( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   682
                "CThumbnailServer::DeleteBitmapFromPool(%d) -- refcount now %d",
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   683
                aHandle, ptr->iRefCount );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   684
            OstTraceExt2( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool) -- refcount now;aHandle=%d;ptr->iRefCount=%d", aHandle, ptr->iRefCount );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   685
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   686
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   687
    else
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   688
        {
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   689
        //__ASSERT_DEBUG(( EFalse ), ThumbnailPanic( EThumbnailBitmapNotReleased ));
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   690
        TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool(%d) -- not found!",
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   691
            aHandle );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   692
        OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool  -- not found!;aHandle=%d", aHandle );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   693
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   694
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   695
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   696
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   697
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   698
// Delete thumbnails for given object file
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   699
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   700
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   701
void CThumbnailServer::DeleteThumbnailsL( const TDesC& aPath )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   702
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   703
    TN_DEBUG2( "CThumbnailServer::DeleteThumbnailsL(%S)", &aPath);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   704
    OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVER_DELETETHUMBNAILSL, "CThumbnailServer::DeleteThumbnailsL;aPath=%S", aPath );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   705
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   706
    StoreForPathL( aPath )->DeleteThumbnailsL( aPath );
11
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
   707
    
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   708
    if( iFetchedChecker ) 
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   709
        {
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   710
        iFetchedChecker->DeleteFetchResult( aPath );
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
   711
        }
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   712
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   713
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   714
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   715
// CThumbnailServer::ResolveMimeTypeL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   716
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   717
//
9
dea39715fc05 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   718
TDataType CThumbnailServer::ResolveMimeTypeL( RFile64& aFile )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   719
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   720
    TN_DEBUG1( "CThumbnailStore::ResolveMimeTypeL()");
9
dea39715fc05 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   721
    RFile64 tmp = aFile;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   722
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   723
    // check if DRM
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   724
    ContentAccess::CData* data = ContentAccess::CData::NewLC( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   725
            tmp, ContentAccess::KDefaultContentObject, ContentAccess::EPeek );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   726
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   727
    TInt filetype( 0 );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   728
    TInt drm( 0 );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   729
    User::LeaveIfError( data->GetAttribute( ContentAccess::EIsProtected, drm ) );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   730
    data->GetAttribute( ContentAccess::EFileType, filetype );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   731
    CleanupStack::PopAndDestroy();    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   732
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   733
	//close aFile on leave	
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   734
    CleanupClosePushL( aFile );    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   735
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   736
    if ( drm && filetype != ContentAccess::EOma1Dcf )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   737
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   738
        // cannot handle other than Oma DRM 1.x files
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   739
        TN_DEBUG1( "CThumbnailStore::ResolveMimeTypeL()- only OMA DRM 1.0 supported");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   740
        OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_RESOLVEMIMETYPEL, "CThumbnailServer::ResolveMimeTypeL - only OMA DRM 1.0 supported" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   741
        User::Leave(KErrNotSupported);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   742
        }    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   743
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   744
    TDataRecognitionResult res;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   745
    if ( iRecognizer.Handle() == KNullHandle )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   746
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   747
        // error using recognizer, (re)connect
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   748
        User::LeaveIfError( iRecognizer.Connect());
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   749
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   750
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   751
    User::LeaveIfError( iRecognizer.RecognizeData( aFile, res ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   752
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   753
    if ( res.iConfidence == CApaDataRecognizerType::ENotRecognized )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   754
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   755
        // file type not supported
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   756
        User::Leave( KErrNotSupported );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   757
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   758
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   759
    CleanupStack::Pop( &aFile );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   760
    return res.iDataType;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   761
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   762
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   763
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   764
// CThumbnailServer::ResolveProviderL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   765
// Resolves plugin to be used in thumbnail creation.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   766
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   767
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   768
CThumbnailProvider* CThumbnailServer::ResolveProviderL( const TDesC8& aMimeType
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   769
    )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   770
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   771
#ifdef _DEBUG
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   772
    TBuf < KMaxDataTypeLength > buf; // 16-bit descriptor for debug prints
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   773
    buf.Copy( aMimeType );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
    TN_DEBUG2( "CThumbnailServer::ResolveProviderL(%S)", &buf );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   775
    OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_RESOLVEMIMETYPEL, "CThumbnailServer::ResolveMimeTypeL;buf=%S", buf );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
#endif 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
    CThumbnailProvider* ret = NULL;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   780
    TInt separatorPos = aMimeType.Locate( KThumbnailMimeSeparatorChar );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
    TPtrC8 mediaType( aMimeType.Left( separatorPos ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   782
    TPtrC8 subType( aMimeType.Mid( separatorPos + 1 )); // skip slash
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   783
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
    const TInt count = iPluginInfoArray.Count();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
    for ( TInt i( 0 ); i < count && !ret; i++ )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   787
        const TDesC8& opaqueData = iPluginInfoArray[i]->OpaqueData();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   788
        TInt pSeparatorPos = opaqueData.Locate( KThumbnailMimeSeparatorChar );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   789
        TPtrC8 pMediaType( opaqueData.Left( pSeparatorPos ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   790
        TPtrC8 pSubType( opaqueData.Mid( pSeparatorPos + 1 )); // skip slash
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   791
        
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   792
        if ( !pMediaType.CompareF( mediaType ))
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   793
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   794
            if ( !pSubType.CompareF( KThumbnailMimeWildCard ) ||
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   795
                !pSubType.CompareF( subType ))
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   796
                {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
#ifdef _DEBUG
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   798
                TN_DEBUG3( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   799
                    "CThumbnailServer::ResolveProviderL(%S) -- using provider 0x%08x", &buf, iPluginInfoArray[i]->ImplementationUid().iUid );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   800
                OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_RESOLVEPROVIDERL, "CThumbnailServer::ResolveProviderL;buf=%S", buf );
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   801
                OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_RESOLVEPROVIDERL, "CThumbnailServer::ResolveProviderL;iPluginInfoArray[i]->ImplementationUid().iUid=%o", iPluginInfoArray[i]->ImplementationUid().iUid );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
#endif 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   803
                ret = GetProviderL( iPluginInfoArray[i]->ImplementationUid());
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   804
                }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   805
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   806
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   807
    if ( !ret )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
#ifdef _DEBUG
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
        TN_DEBUG2( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
            "CThumbnailServer::ResolveProviderL(%S) -- provider not found",
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   812
            &buf );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   813
        OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVER_RESOLVEPROVIDERL, "CThumbnailServer::ResolveProviderL;buf=%S", buf );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   814
#endif 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   815
        User::Leave( KErrNotSupported );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   816
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   817
    return ret;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   818
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   819
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   820
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   821
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   822
// CThumbnailServer::GetProviderL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   823
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   824
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   825
CThumbnailProvider* CThumbnailServer::GetProviderL( const TUid& aImplUid )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   826
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   827
    CThumbnailProvider** resPtr = iProviders.Find( aImplUid.iUid );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   828
    CThumbnailProvider* res = NULL;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   829
    if ( resPtr )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   830
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   831
        // Use existing instance
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   832
        res = * resPtr;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   833
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   834
    else
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   835
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   836
        // Plug-in needs to be loaded
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   837
        TN_DEBUG2( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   838
            "CThumbnailServer::GetProviderL() -- loading plug-in, UID 0x%08x",
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   839
            aImplUid );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   840
        res = CThumbnailProvider::NewL( aImplUid );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   841
        TN_DEBUG1( "CThumbnailServer::GetProviderL() -- loading complete" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   842
        OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_GETPROVIDERL, "CThumbnailServer::GetProviderL -- loading complete" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   843
        CleanupStack::PushL( res );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   844
        iProviders.InsertL( aImplUid.iUid, res );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   845
        CleanupStack::Pop( res );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   846
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
    return res;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   849
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   850
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   851
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   852
// -----------------------------------------------------------------------------
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   853
// CThumbnailServer::PreLoadProviders()
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   854
// -----------------------------------------------------------------------------
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   855
//
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   856
void CThumbnailServer::PreLoadProviders(  )
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   857
    {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   858
    TN_DEBUG1( "CThumbnailServer::PreLoadProvidersL()" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   859
    OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_PRELOADPROVIDERS, "CThumbnailServer::PreLoadProviders" );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   860
    TInt err(KErrNone);
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   861
    
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   862
    for(TInt i=0; i< iPluginInfoArray.Count(); i++)
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   863
        {
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   864
        TRAP(err, GetProviderL( iPluginInfoArray[i]->ImplementationUid()));
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   865
        }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   866
    }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   867
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   868
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   869
// -----------------------------------------------------------------------------
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   870
// CThumbnailServer::QueueTaskL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   871
// Adds thumbnailtask to processor queue.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   872
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   874
void CThumbnailServer::QueueTaskL( CThumbnailTask* aTask )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   875
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   876
    __ASSERT_DEBUG(( aTask ), ThumbnailPanic( EThumbnailNullPointer ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   877
    iProcessor->AddTaskL( aTask );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   878
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   879
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   880
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   881
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   882
// CThumbnailServer::DequeTask()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   883
// Removes thumbnailtask from processor queue.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   884
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   885
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   886
TInt CThumbnailServer::DequeTask( const TThumbnailServerRequestId& aRequestId )
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   887
    {   
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   888
    TInt error = iProcessor->RemoveTask( aRequestId );
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   889
        
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   890
    // clean-up bitmap pool               
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   891
    THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   892
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   893
    // const pointer to a non-const object
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   894
    const TThumbnailBitmapRef* ref = bpiter.NextValue();
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   895
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   896
    while ( ref )
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   897
        {       
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   898
        TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   899
        OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_DEQUETASK, "CThumbnailServer::DequeTask;ref->iRequestId=%u", ref->iRequestId );
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   900
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   901
        if ( ref->iSession == aRequestId.iSession && 
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   902
             ref->iRequestId == aRequestId.iRequestId )
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   903
            {            
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   904
            delete ref->iBitmap;
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   905
            bpiter.RemoveCurrent();                        
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   906
                        
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   907
            TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d", 
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   908
                    iBitmapPool.Count());
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   909
            OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_DEQUETASK, "CThumbnailServer::DequeTask;iBitmapPool.Count()=%d", iBitmapPool.Count() );
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   910
            }
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   911
        
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   912
        ref = bpiter.NextValue();        
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   913
        }
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   914
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   915
    return error;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   916
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   917
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   918
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   919
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   920
// CThumbnailServer::ChangeTaskPriority()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   921
// Changes priority of specific task.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   922
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   923
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   924
TInt CThumbnailServer::ChangeTaskPriority( const TThumbnailServerRequestId&
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   925
    aRequestId, TInt aNewPriority )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   926
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   927
    return iProcessor->ChangeTaskPriority( aRequestId, aNewPriority );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   928
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   929
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   930
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   931
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   932
// CThumbnailServer::ScaleBitmapL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   933
// Used to scale image.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   934
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   935
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   936
void CThumbnailServer::ScaleBitmapL( TRequestStatus& aStatus, const CFbsBitmap&
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   937
    aSource, CFbsBitmap& aDest, const TRect& aSourceRect )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   938
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   939
    if ( !iScaler )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   940
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   941
        iScaler = IHLScaler::CreateL();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   942
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   943
    TRect destRect( TPoint(), aDest.SizeInPixels());
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   944
    User::LeaveIfError( iScaler->Scale( aStatus, aSource, aSourceRect, aDest,
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   945
        destRect ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   946
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   947
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   948
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   949
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   950
// CThumbnailServer::CancelScale()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   951
// Cancels scaling task.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   952
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   953
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   954
void CThumbnailServer::CancelScale()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   955
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   956
    if ( iScaler )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   957
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   958
        iScaler->CancelProcess();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   959
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   960
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   961
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   962
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   963
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   964
// CThumbnailServer::Processor()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   965
// Returns processor.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   966
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   967
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   968
CThumbnailTaskProcessor& CThumbnailServer::Processor()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   969
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   970
    __ASSERT_DEBUG(( iProcessor ), ThumbnailPanic( EThumbnailNullPointer ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   971
    return * iProcessor;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   972
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   973
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   974
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   975
// Get the thumbnail store instance, which is responsible for this drive
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   976
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   977
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   978
CThumbnailStore* CThumbnailServer::StoreForDriveL( const TInt aDrive )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   979
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   980
    TN_DEBUG2( "CThumbnailServer::StoreForDriveL() drive=%d", aDrive );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   981
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL;aDrive=%d", aDrive );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   982
    
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   983
    if(iUnmountedDrives.Find( aDrive ) >= KErrNone)
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   984
        {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   985
        TN_DEBUG1( "CThumbnailServer::StoreForDriveL() unmount in progress, skip!");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
   986
        OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - unmount in progress, skip!" );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   987
        User::Leave( KErrDisMounted );
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   988
        }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   989
    
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   990
    CThumbnailStore** resPtr = iStores.Find( aDrive );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   991
    CThumbnailStore* res = NULL;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   992
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   993
    if ( resPtr )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   994
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   995
        res = * resPtr;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   996
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   997
    else
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   998
        {
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   999
        if( iFormatting )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1000
           {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1001
           TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1002
           OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - FORMATTING! - ABORT" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1003
           User::Leave( KErrNotSupported );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1004
           } 
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1005
        
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1006
        TVolumeInfo volumeInfo;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1007
        TInt err = iFs.Volume( volumeInfo, aDrive );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1008
        
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1009
        if ( err )
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1010
            {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1011
            // Locked
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1012
            TN_DEBUG2( "CThumbnailServer::StoreForDriveL() - err %d", err);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1013
            OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL;err=%d", err );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1014
            User::Leave( err);
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1015
            }
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1016
        else if( volumeInfo.iDrive.iMediaAtt& KMediaAttLocked )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1017
            {
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1018
            TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - locked");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1019
            OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - locked" );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1020
            User::Leave( KErrAccessDenied );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1021
            }
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1022
		else if ( volumeInfo.iDrive.iDriveAtt& KDriveAttRom ||
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1023
            volumeInfo.iDrive.iDriveAtt& KDriveAttRemote ||
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1024
            volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected )
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1025
            {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1026
            // We support ROM disks and remote disks in read only mode.
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1027
            TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - rom/remote/write protected");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1028
            OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - rom/remote/write protected" );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1029
            res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, ETrue );
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1030
            }
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1031
        else
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1032
            {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1033
            TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - normal");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1034
            OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - normal" );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1035
            res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, EFalse );
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1036
            }
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1037
			
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1038
        CleanupStack::PushL( res );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1039
        iStores.InsertL( aDrive, res );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1040
        res->SetPersistentSizes(iPersistentSizes);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1041
        CleanupStack::Pop( res );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1042
        
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1043
        for(TInt i = 0; i < iUnmountObservers.Count(); i++)
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1044
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1045
            iUnmountObservers[i]->StartNotify();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1046
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1047
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1048
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1049
    return res;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1050
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1051
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1052
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1053
// Get the thumbnail store instance, which is responsible for the drive
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1054
// identified by given path
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1055
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1056
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1057
CThumbnailStore* CThumbnailServer::StoreForPathL( const TDesC& aPath )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1058
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1059
    if(aPath.Length() < 3 || aPath.Length() > KMaxPath)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1060
        {
1
235a7fc86938 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1061
        TN_DEBUG1( "CThumbnailServer::StoreForPathL() - KErrArgument");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1062
        OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_STOREFORPATHL, "CThumbnailServer::StoreForPathL - KErrArgument" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1063
        User::Leave(KErrArgument);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1064
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1065
    TInt drive = 0;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1066
    User::LeaveIfError( RFs::CharToDrive( aPath[0], drive ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1067
    return StoreForDriveL( drive );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1068
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1069
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1070
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1071
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1072
// CThumbnailStore::PersistentSizeL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1073
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1074
//
11
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
  1075
TThumbnailPersistentSize & CThumbnailServer::PersistentSizeL( TThumbnailSize aThumbnailSize )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1076
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1077
    if ( !iCenrep )
11
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
  1078
       {
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
  1079
       iCenrep = CThumbnailCenRep::NewL();
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
  1080
       }
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1081
    
11
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
  1082
    return iCenrep->PersistentSizeL( aThumbnailSize ); 
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1083
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1084
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1085
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1086
// Open store for each mounted drive
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1087
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1088
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1089
void CThumbnailServer::OpenStoresL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1090
    {      
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1091
    // get list of mounted drives and open stores
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1092
    TDriveList driveListInt;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1093
    TInt driveCountInt(0);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1094
    User::LeaveIfError(DriveInfo::GetUserVisibleDrives(
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1095
           iFs, driveListInt, driveCountInt, KDriveAttInternal | KDriveAttRemovable ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1096
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1097
    for( TInt i = EDriveA; i <= EDriveZ && driveCountInt; i++ )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1098
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1099
        if (driveListInt[i])
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1100
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1101
            TVolumeInfo volumeInfo;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1102
            TInt err = iFs.Volume( volumeInfo, i );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1103
            
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1104
            if (!err)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1105
                {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1106
                TN_DEBUG2( "CThumbnailServer::OpenStoresL() StoreForDriveL %d", i);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1107
                OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_OPENSTORESL, "CThumbnailServer::OpenStoresL;i=%d", i );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1108
                
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1109
                // ignore errors
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1110
                TRAP_IGNORE( StoreForDriveL( i ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1111
                
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1112
                driveCountInt--;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1113
                }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1114
            }            
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1115
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1116
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1117
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1118
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1119
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1120
// Close the thumbnail store instance, which is responsible for this drive
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1121
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1122
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1123
void CThumbnailServer::CloseStoreForDriveL( const TInt aDrive )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1124
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1125
    TN_DEBUG2( "CThumbnailServer::CloseStoreForDriveL drive=%d", aDrive);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1126
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_CLOSESTOREFORDRIVEL, "CThumbnailServer::CloseStoreForDriveL;aDrive=%d", aDrive );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1127
    CThumbnailStore** store = iStores.Find( aDrive );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1128
    
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1129
    StartUnmountTimeout( aDrive);
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1130
    
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1131
    if (store)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1132
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1133
        delete *store;
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1134
        *store = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1135
        iStores.Remove( aDrive );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1136
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1137
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1138
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1139
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1140
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1141
// CThumbnailStore::PersistentSizes()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1142
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1143
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1144
RArray < TThumbnailPersistentSize > CThumbnailServer::PersistentSizesL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1145
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1146
    return iPersistentSizes;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1147
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1148
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1149
void CThumbnailServer::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray <
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1150
    TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly  )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1151
    {
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1152
    StoreForPathL( aPath )->GetMissingSizesL( aPath, aSourceType, aMissingSizes, aCheckGridSizeOnly );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1153
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1154
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1155
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1156
// CThumbnailServer::Fs()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1157
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1158
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1159
RFs& CThumbnailServer::Fs()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1160
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1161
    return iFs;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1162
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1163
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1164
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1165
// CThumbnailServer::AddUnmountObserversL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1166
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1167
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1168
void CThumbnailServer::AddUnmountObserversL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1169
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1170
    TDriveList driveList;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1171
    TInt drive; 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1172
    TDriveInfo driveInfo;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1173
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1174
    iUnmountObservers.ResetAndDestroy();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1175
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1176
    User::LeaveIfError( iFs.DriveList(driveList) );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1177
   
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1178
    // search all drives
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1179
    for( drive = EDriveA; drive <= EDriveZ; drive++ )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1180
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1181
        if( !driveList[drive] ) 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1182
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1183
            // If drive-list entry is zero, drive is not available
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1184
            continue;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1185
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1186
        
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1187
        TInt err = iFs.Drive(driveInfo, drive);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1188
        
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1189
        // if removable drive, add observer
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1190
        if (!err && driveInfo.iDriveAtt& KDriveAttRemovable)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1191
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1192
            TN_DEBUG2( "CThumbnailServer::AddOnMountObserver drive=%d", drive);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1193
            OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_ADDUNMOUNTOBSERVERSL, "CThumbnailServer::AddUnmountObserversL;drive=%d", drive );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1194
            CThumbnailDiskUnmountObserver* obs = CThumbnailDiskUnmountObserver::NewL( iFs, drive, this );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1195
            CleanupStack::PushL( obs );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1196
            iUnmountObservers.AppendL( obs );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1197
            CleanupStack::Pop( obs );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1198
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1199
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1200
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1201
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1202
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1203
// CThumbnailServer::MemoryCardStatusChangedL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1204
// ---------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1205
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1206
void CThumbnailServer::MemoryCardStatusChangedL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1207
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1208
    TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL in()" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1209
    OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - in" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1210
    TDriveList driveList;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1211
    TInt drive; 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1212
    TVolumeInfo volumeInfo;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1213
    TDriveInfo driveInfo;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1214
        
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1215
    User::LeaveIfError( iFs.DriveList(driveList) );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1216
       
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1217
    // search all drives
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1218
    for( drive = EDriveA; drive <= EDriveZ; drive++ )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1219
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1220
        if( !driveList[drive] ) 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1221
           {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1222
          // If drive-list entry is zero, drive is not available
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1223
            continue;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1224
           }
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1225
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1226
        TInt err = iFs.Volume(volumeInfo, drive);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1227
        TInt err_drive = iFs.Drive(driveInfo, drive);    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1228
        
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1229
        // mount -- if removable drive, add new store
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1230
        if (!err && !err_drive 
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1231
                && driveInfo.iType != EMediaNotPresent
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1232
                && driveInfo.iDriveAtt& KDriveAttRemovable )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1233
            {
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1234
            TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL mount drive==%d", drive);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1235
            OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL;drive=%d", drive );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1236
            
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1237
            CThumbnailStore** resPtr = iStores.Find( drive );
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1238
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1239
            if ( resPtr )
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1240
                {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1241
                TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() already mounted, skip %d", drive);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1242
                OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL;drive=%d", drive );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1243
                continue;
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1244
                }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1245
            
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1246
            // ignore errors
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1247
            TRAP_IGNORE( StoreForDriveL( drive ));
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1248
            
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1249
            TUint driveStatus(0);
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1250
            DriveInfo::GetDriveStatus(iFs, drive, driveStatus);
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1251
            TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() driveStatus = %d", driveStatus);
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1252
            if (!(driveStatus & DriveInfo::EDriveUsbMemory) && 
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1253
			    !(driveStatus & DriveInfo::EDriveRemote))
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1254
                {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1255
                TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft = %d", KErrNotReady);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1256
                OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL;KErrNotReady=%d - update KItemsleft", KErrNotReady );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1257
                RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady );
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1258
                }
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1259
			
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1260
            TInt index = iUnmountedDrives.Find( drive );
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1261
            
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1262
            if(index >= KErrNone)
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1263
                {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1264
                iUnmountedDrives.Remove( index );
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1265
                }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1266
            
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1267
            if(!iUnmountedDrives.Count()&& iUnmount && iUnmount->IsActive())
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1268
                {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1269
                TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL() cancel unmount timer");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1270
                OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - cancel unmount timer" );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1271
                iUnmount->Cancel();
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1272
                }
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1273
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1274
        
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1275
        //dismount -- if removable drive, close store
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1276
        else if(err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1277
            {
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1278
            TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() unmount drive==%d", drive);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1279
            OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - unmount drive;drive=%d", drive );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1280
            CloseStoreForDriveL( drive);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1281
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1282
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1283
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1284
    TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL out()" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1285
    OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - out" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1286
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1287
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1288
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1289
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1290
// Get the required size (in characters) for a buffer that contains the
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1291
// list of supported MIME types
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1292
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1293
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1294
TInt CThumbnailServer::GetMimeTypeBufferSize()const
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1295
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1296
    TInt size = 0;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1297
    for ( TInt i = iPluginInfoArray.Count(); --i >= 0; )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1298
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1299
        const TDesC8& opaqueData = iPluginInfoArray[i]->OpaqueData();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1300
        size += opaqueData.Length();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1301
        size++; // space for separator character
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1302
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1303
    if ( size )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1304
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1305
        size--; // no need for a separator character at the end
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1306
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1307
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1308
    return size;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1309
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1310
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1311
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1312
// Get the list of supported MIME types and store them in the buffer
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1313
// allocated by the client.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1314
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1315
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1316
void CThumbnailServer::GetMimeTypeList( TDes& aBuffer )const
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1317
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1318
    TBuf < KMaxDataTypeLength > buf; // needed for convert from TBuf8 to TBuf
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1319
    aBuffer.Zero();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1320
    const TInt count = iPluginInfoArray.Count();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1321
    for ( TInt i = 0; i < count; i++ )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1322
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1323
        const TDesC8& opaqueData = iPluginInfoArray[i]->OpaqueData();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1324
        buf.Copy( opaqueData );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1325
        aBuffer.Append( buf );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1326
        aBuffer.Append( KThumbnailMimeTypeSeparatorChar );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1327
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1328
    if ( count )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1329
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1330
        // remove last separator char
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1331
        aBuffer.SetLength( aBuffer.Length() - 1 );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1332
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1333
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1334
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1335
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1336
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1337
// Updates thumbnails by given Id.
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1338
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1339
//
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1340
TBool CThumbnailServer::UpdateThumbnailsL( const TDesC& aPath,
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1341
                                           const TInt /*aOrientation*/, const TInt64 aModified )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1342
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1343
    TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL()");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1344
    OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1345
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1346
    // 1. check path change
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1347
    // 2. check timestamp change
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1348
    TBool modifiedChanged = EFalse;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1349
    
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1350
    CThumbnailStore* store = StoreForPathL( aPath );
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1351
   
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1352
    TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exist");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1353
    OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - exist" );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1354
        
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1355
    TBool exists = store->CheckModifiedByPathL(aPath, aModified, modifiedChanged);
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1356
       
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1357
    if(!exists)
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1358
        {
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1359
        TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exists NO");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1360
    	OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - exists NO" );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1361
        //not found, needs to be generated
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1362
        return EFalse;
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1363
        }
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1364
    
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1365
    TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified ?");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1366
    OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - modified ?" );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1367
    
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1368
    if (modifiedChanged)
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1369
        {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1370
        TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified YES");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1371
        OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - modified YES" );
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1372
            
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1373
        // delete old thumbs
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1374
        store->DeleteThumbnailsL(aPath, ETrue);
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1375
            
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1376
        if( iFetchedChecker ) 
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1377
            {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1378
            iFetchedChecker->DeleteFetchResult( aPath );
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1379
            }
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1380
            
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1381
        // need to create new thumbs
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1382
        }
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1383
    else
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1384
        {
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1385
        TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified NO");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1386
        OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - modified NO" );
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1387
        
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1388
        // not modified
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1389
        return ETrue;
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1390
        }
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1391
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1392
    TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - no thumbs found, create new");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1393
    OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - no thumbs found, create new" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1394
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1395
    return EFalse;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1396
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1397
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1398
// -----------------------------------------------------------------------------
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1399
// Renames thumbnails.
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1400
// -----------------------------------------------------------------------------
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1401
//
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1402
void CThumbnailServer::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath )
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1403
    {
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1404
    TN_DEBUG2( "CThumbnailServer::RenameThumbnailsL(%S)", &aCurrentPath);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1405
    OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVER_RENAMETHUMBNAILSL, "CThumbnailServer::RenameThumbnailsL;aCurrentPath=%S", aCurrentPath );
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1406
    
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1407
    StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath );
11
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
  1408
    
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
  1409
    if( iFetchedChecker ) 
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
  1410
        {
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1411
        iFetchedChecker->RenameFetchResultL( aNewPath, aCurrentPath );
11
85a88bc05e45 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
  1412
        }
10
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1413
    }
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1414
ee674526fac5 Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 9
diff changeset
  1415
// -----------------------------------------------------------------------------
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1416
// CThumbnailServer::MimeTypeFromFileExt()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1417
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1418
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1419
TInt CThumbnailServer::MimeTypeFromFileExt( const TDesC& aFileName, TDataType& aMimeType )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1420
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1421
    TBool found = ETrue;
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1422
    TPtrC ext( aFileName.Right(KExtLength) ); // tparse panics with virtual URI
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1423
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1424
    if ( ext.CompareF( KJpegExt ) == 0 || ext.CompareF( KJpgExt ) == 0)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1425
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1426
        aMimeType = TDataType( KJpegMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1427
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1428
    else if ( ext.CompareF( KJpeg2000Ext ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1429
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1430
        aMimeType = TDataType( KJpeg2000Mime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1431
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1432
    else if ( ext.CompareF( KSvgExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1433
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1434
        aMimeType = TDataType( KSvgMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1435
        }    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1436
    else if ( ext.CompareF( KGifExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1437
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1438
        aMimeType = TDataType( KGifMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1439
        } 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1440
    else if ( ext.CompareF( KPngExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1441
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1442
        aMimeType = TDataType( KPngMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1443
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1444
    else if ( ext.CompareF( KMpgExt1 ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1445
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1446
        aMimeType = TDataType( KMpgMime1 );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1447
        } 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1448
    else if ( ext.CompareF( KMpeg4Ext ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1449
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1450
        aMimeType = TDataType( KMpeg4Mime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1451
        } 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1452
    else if ( ext.CompareF( KMp4Ext ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1453
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1454
        aMimeType = TDataType( KMp4Mime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1455
        } 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1456
    else if ( ext.CompareF( KAviExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1457
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1458
        aMimeType = TDataType( KAviMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1459
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1460
    else if ( ext.CompareF( KMp3Ext ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1461
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1462
        aMimeType = TDataType( KMp3Mime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1463
        } 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1464
    else if ( ext.CompareF( KNonEmbeddArtExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1465
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1466
        aMimeType = TDataType( KNonEmbeddArtMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1467
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1468
    else if ( ext.CompareF( KAacExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1469
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1470
        aMimeType = TDataType( KAacMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1471
        }   
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1472
    else if ( ext.CompareF( KWmaExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1473
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1474
        aMimeType = TDataType( KWmaMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1475
        } 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1476
    else if ( ext.CompareF( KBmpExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1477
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1478
        aMimeType = TDataType( KBmpMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1479
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1480
    else if ( ext.CompareF( K3gpExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1481
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1482
        aMimeType = TDataType( KVideo3gppMime );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1483
        return KErrNotFound; 
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1484
        // 3gp can contain video or audio, should go to recognizer
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1485
        } 
14
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
  1486
    else if ( ext.CompareF( K3gppExt ) == 0 )
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
  1487
        {
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
  1488
        aMimeType = TDataType( KVideo3gppMime );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1489
        return KErrNotFound; 
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1490
        // 3gp can contain video or audio, should go to recognizer
14
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
  1491
        }
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1492
    else if ( ext.CompareF( KAmrExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1493
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1494
        aMimeType = TDataType( KAudioAmrMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1495
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1496
    else if ( ext.CompareF( KWmvExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1497
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1498
        aMimeType = TDataType( KVideoWmvMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1499
        } 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1500
    else if ( ext.CompareF( KRealAudioExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1501
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1502
        aMimeType = TDataType( KRealAudioMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1503
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1504
    else if ( ext.CompareF( KPmRealAudioPluginExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1505
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1506
        aMimeType = TDataType( KPmRealAudioPluginMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1507
        } 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1508
    else if ( ext.CompareF( KRealVideoExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1509
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1510
        aMimeType = TDataType( KRealVideoMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1511
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1512
    else if ( ext.CompareF( KM4aExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1513
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1514
        aMimeType = TDataType( KM4aMime);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1515
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1516
    else if ( ext.CompareF( KM4vExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1517
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1518
        aMimeType = TDataType( KMp4Mime);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1519
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1520
    else if ( ext.CompareF( KPmRealVideoPluginExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1521
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1522
        aMimeType = TDataType( KPmRealVideoPluginMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1523
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1524
    else if ( ext.CompareF( KPmRealVbVideoPluginExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1525
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1526
        aMimeType = TDataType( KPmRealVbVideoPluginMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1527
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1528
    else if ( ext.CompareF( KFlashVideoExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1529
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1530
        aMimeType = TDataType( KFlashVideoMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1531
        } 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1532
    else if ( ext.CompareF( KMatroskaVideoExt ) == 0 )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1533
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1534
        aMimeType = TDataType( KMatroskaVideoMime );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1535
        } 
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1536
    else if ( ext.CompareF( KContactExt ) == 0 )
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1537
        {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1538
        aMimeType = TDataType( KContactMime );
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1539
        } 
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1540
    else if ( ext.CompareF( KAlbumArtExt ) == 0 )
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1541
        {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1542
        aMimeType = TDataType( KAlbumArtMime );
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1543
        }
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1544
    else
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1545
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1546
        aMimeType = TDataType( KNullDesC8 );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1547
        found = EFalse;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1548
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1549
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1550
    if (found)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1551
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1552
        return KErrNone;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1553
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1554
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1555
    return KErrNotFound;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1556
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1557
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1558
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1559
// CThumbnailServer::SourceTypeFromMimeType()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1560
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1561
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1562
TInt CThumbnailServer::SourceTypeFromMimeType( const TDataType& aMimeType )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1563
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1564
    const TPtrC8 mimeType = aMimeType.Des8();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1565
  
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1566
    TInt separatorPos = mimeType.Locate( KThumbnailMimeSeparatorChar );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1567
    TPtrC8 mediaType( mimeType.Left( separatorPos ));
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1568
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1569
    if (mediaType.Compare(KThumbnailMimeImage) == 0)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1570
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1571
        return TThumbnailPersistentSize::EImage;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1572
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1573
    else if (mediaType.Compare(KThumbnailMimeVideo) == 0)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1574
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1575
        return TThumbnailPersistentSize::EVideo;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1576
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1577
    else if (mediaType.Compare(KThumbnailMimeAudio) == 0)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1578
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1579
        return TThumbnailPersistentSize::EAudio;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1580
        }
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1581
    else if (mediaType.Compare(KThumbnailMimeContact) == 0)
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1582
        {
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1583
        return TThumbnailPersistentSize::EContact;
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1584
        }
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1585
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1586
    return TThumbnailPersistentSize::EUnknownSourceType;        
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1587
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1588
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1589
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1590
// CThumbnailServer::SourceTypeFromSizeType()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1591
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1592
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1593
TInt CThumbnailServer::SourceTypeFromSizeType( const TInt aSizeType )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1594
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1595
    TInt sourceType = 0;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1596
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1597
    switch (aSizeType)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1598
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1599
        case EImageGridThumbnailSize:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1600
        case EImageListThumbnailSize:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1601
        case EImageFullScreenThumbnailSize:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1602
            sourceType = TThumbnailPersistentSize::EImage;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1603
            break;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1604
        case EVideoGridThumbnailSize:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1605
        case EVideoListThumbnailSize:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1606
        case EVideoFullScreenThumbnailSize:  
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1607
            sourceType = TThumbnailPersistentSize::EVideo;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1608
            break;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1609
        case EAudioGridThumbnailSize:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1610
        case EAudioListThumbnailSize:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1611
        case EAudioFullScreenThumbnailSize:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1612
            sourceType = TThumbnailPersistentSize::EAudio;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1613
            break;
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1614
        case EContactListThumbnailSize:
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1615
        case EContactGridThumbnailSize:
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1616
        case EContactFullScreenThumbnailSize:
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1617
            sourceType = TThumbnailPersistentSize::EContact;
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1618
            break;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1619
        default:
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1620
            sourceType = TThumbnailPersistentSize::EUnknownSourceType;  
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1621
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1622
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1623
    return sourceType;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1624
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1625
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1626
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1627
// CThumbnailServer::SupportedMimeType()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1628
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1629
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1630
TBool CThumbnailServer::SupportedMimeType( const TDataType& aMimeType )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1631
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1632
    const TPtrC8 mimeType = aMimeType.Des8();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1633
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1634
    if ( mimeType.CompareF( KJpegMime ) == 0 || 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1635
         mimeType.CompareF( KJpeg2000Mime ) == 0 ||
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1636
         mimeType.CompareF( KGifMime ) == 0 ||
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1637
         mimeType.CompareF( KPngMime ) == 0 ||
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1638
         mimeType.CompareF( KSvgMime ) == 0 ||
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1639
         mimeType.CompareF( KMpgMime1 ) == 0 ||
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1640
         mimeType.CompareF( KMpeg4Mime ) == 0 ||
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1641
         mimeType.CompareF( KMp4Mime ) == 0 ||
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1642
         mimeType.CompareF( KAviMime ) == 0 ||
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1643
         mimeType.CompareF( KMp3Mime ) == 0 ||
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1644
         mimeType.CompareF( KNonEmbeddArtMime ) == 0 ||
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1645
         mimeType.CompareF( KM4aMime ) == 0  ||
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1646
         mimeType.CompareF( KAacMime ) == 0 ||
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1647
         mimeType.CompareF( KWmaMime ) == 0 ||
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1648
         mimeType.CompareF( KBmpMime ) == 0 ||         
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1649
         mimeType.CompareF( KAudio3gppMime ) == 0 ||
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1650
         mimeType.CompareF( KVideo3gppMime ) == 0 ||
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1651
         mimeType.CompareF( KAudioAmrMime ) == 0 ||
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1652
         mimeType.CompareF( KVideoWmvMime ) == 0 ||
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1653
         mimeType.CompareF( KRealAudioMime ) == 0 ||
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1654
         mimeType.CompareF( KPmRealAudioPluginMime ) == 0 ||
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1655
         mimeType.CompareF( KPmRealVideoPluginMime ) == 0 ||
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1656
         mimeType.CompareF( KPmRealVbVideoPluginMime ) == 0 ||
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1657
         mimeType.CompareF( KRealVideoMime ) == 0 ||
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1658
         mimeType.CompareF( KFlashVideoMime ) == 0 ||
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1659
         mimeType.CompareF( KMatroskaVideoMime ) == 0 ||
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1660
         mimeType.CompareF( KContactMime ) == 0 ||
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1661
         mimeType.CompareF( KAlbumArtMime ) == 0 )
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1662
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1663
        return ETrue;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1664
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1665
    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1666
    return EFalse;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1667
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1668
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1669
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1670
// CThumbnailServer::GetMdESession()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1671
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1672
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1673
CMdESession* CThumbnailServer::GetMdESession()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1674
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1675
    return iMdESession;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1676
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1677
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1678
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1679
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1680
// E32Main()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1681
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1682
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1683
TInt E32Main()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1684
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1685
    __UHEAP_MARK;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1686
    CTrapCleanup* cleanup = CTrapCleanup::New();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1687
    TInt result = KErrNoMemory;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1688
    if ( cleanup )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1689
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1690
        TRAP( result, CThumbnailServer::ThreadFunctionL());
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1691
        TN_DEBUG2( 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1692
            "CThumbnailServer::E32Main() -- thread function out, result=%d",
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1693
            result );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1694
        OstTrace1( TRACE_NORMAL, _E32MAIN, "::E32Main;result=%d - thread function out", result );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1695
        delete cleanup;
20
2b4b06654caa Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1696
        cleanup = NULL;
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1697
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1698
    if ( result != KErrNone )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1699
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1700
        // Signal the client that server creation failed
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1701
        TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() in" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1702
        OstTrace0( TRACE_NORMAL, DUP2__E32MAIN, "::E32Main - in" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1703
        RProcess::Rendezvous( result );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1704
        TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() out" );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1705
        OstTrace0( TRACE_NORMAL, DUP1__E32MAIN, "::E32Main - out" );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1706
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1707
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1708
    __UHEAP_MARKEND;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1709
    return result;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1710
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1711
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1712
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1713
// Closes stores for removable drives
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1714
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1715
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1716
void CThumbnailServer::CloseRemovableDrivesL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1717
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1718
    TDriveList driveList;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1719
    TInt drive; 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1720
    TDriveInfo driveInfo;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1721
    iFormatting = ETrue;    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1722
        
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1723
    User::LeaveIfError( iFs.DriveList(driveList) );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1724
       
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1725
    // search all drives
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1726
    for( drive = EDriveA; drive <= EDriveZ; drive++ )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1727
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1728
        if( !driveList[drive] ) 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1729
           {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1730
           // If drive-list entry is zero, drive is not available
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1731
           continue;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1732
           }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1733
            
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1734
        TInt err = iFs.Drive(driveInfo, drive);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1735
            
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1736
        // if removable drive, close store
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1737
        if (!err && driveInfo.iDriveAtt& KDriveAttRemovable)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1738
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1739
            TN_DEBUG2( "CThumbnailServer::CloseRemovableDrive drive=%d", drive);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1740
            OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_CLOSEREMOVABLEDRIVESL, "CThumbnailServer::CloseRemovableDrivesL;drive=%d", drive );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1741
            CloseStoreForDriveL(drive);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1742
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1743
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1744
    iProcessor->RemoveAllTasks();
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1745
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1746
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1747
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1748
// Open Stores for removable drives
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1749
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1750
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1751
void CThumbnailServer::OpenRemovableDrivesL()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1752
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1753
    TDriveList driveList;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1754
    TInt drive; 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1755
    TDriveInfo driveInfo;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1756
    iFormatting = EFalse;    
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1757
        
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1758
    User::LeaveIfError( iFs.DriveList(driveList) );
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1759
       
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1760
    // search all drives
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1761
    for( drive = EDriveA; drive <= EDriveZ; drive++ )
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1762
        {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1763
        if( !driveList[drive] ) 
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1764
           {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1765
           // If drive-list entry is zero, drive is not available
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1766
           continue;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1767
           }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1768
            
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1769
        TInt err = iFs.Drive(driveInfo, drive);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1770
            
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1771
        // if removable drive, open store
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1772
        if (!err && driveInfo.iDriveAtt& KDriveAttRemovable)
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1773
            {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1774
            TN_DEBUG2( "CThumbnailServer::OpenRemovableDrive drive=%d", drive);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1775
            OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_OPENREMOVABLEDRIVESL, "CThumbnailServer::OpenRemovableDrivesL;drive=%d", drive );
0
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1776
            StoreForDriveL(drive);
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1777
            }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1778
        }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1779
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1780
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1781
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1782
// Is formatting ongoing
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1783
// -----------------------------------------------------------------------------
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1784
//
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1785
TBool CThumbnailServer::IsFormatting()
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1786
    {
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1787
    return iFormatting;
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1788
    }
2014ca87e772 Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1789
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1790
// ---------------------------------------------------------------------------
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1791
// CThumbnailServer::FormatNotification
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1792
// Handles a format operation
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1793
// ---------------------------------------------------------------------------
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1794
//
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1795
void CThumbnailServer::FormatNotification( TBool aFormat )
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1796
    {
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1797
    TN_DEBUG2( "CThumbnailServer::FormatNotification(%d)", aFormat );
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1798
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_FORMATNOTIFICATION, "CThumbnailServer::FormatNotification;aFormat=%d", aFormat );
5
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1799
    
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1800
    if(aFormat)
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1801
        {
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1802
        TRAP_IGNORE( CloseRemovableDrivesL() );
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1803
        }
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1804
    else 
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1805
        {
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1806
        TRAP_IGNORE( OpenRemovableDrivesL() );
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1807
        }
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1808
    }
82749d516180 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1809
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1810
// ---------------------------------------------------------------------------
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1811
// CThumbnailServer::ReconnectCallBack()
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1812
// ---------------------------------------------------------------------------
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1813
//
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1814
TInt CThumbnailServer::ReconnectCallBack(TAny* aAny)
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1815
    {
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1816
    TN_DEBUG1( "CThumbnailServer::ReconnectCallBack() - reconnect");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1817
    OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_RECONNECTCALLBACK, "CThumbnailServer::ReconnectCallBack - reconnect" );
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1818
    
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1819
    CThumbnailServer* self = static_cast<CThumbnailServer*>( aAny );
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1820
    
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1821
    self->iReconnect->Cancel();
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1822
    
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1823
    if (self->iMdESession)
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1824
        {
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1825
        delete self->iMdESession;
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1826
        self->iMdESession = NULL;
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1827
        }
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1828
    
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1829
    // reconnect to MDS
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1830
    TRAP_IGNORE( self->iMdESession = CMdESession::NewL( *self ) );
14
ad31f4183ddc Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 13
diff changeset
  1831
    self->iSessionError = EFalse;
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1832
    
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1833
    TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - done");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1834
    OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_RECONNECTCALLBACK, "CThumbnailServer::ReconnectCallBack - done" );
7
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1835
    
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1836
    return KErrNone;
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1837
    }
2eb74cf6572e Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1838
15
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1839
// -----------------------------------------------------------------------------
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1840
// CThumbnailServer::IsPublicPath
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1841
// -----------------------------------------------------------------------------
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1842
//
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1843
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1844
TBool CThumbnailServer::IsPublicPath( const TDesC& aPath )
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1845
    {
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1846
    TInt pos = aPath.FindF(KPrivateFolder);
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1847
    
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1848
    if ( pos == 1 )
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1849
        {
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1850
        TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1851
        OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_ISPUBLICPATH, "CThumbnailServer::IsPublicPath - NO" );
15
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1852
        return EFalse;
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1853
        }
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1854
    
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1855
    pos = aPath.FindF(KSysFolder);
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1856
    if ( pos == 1 )
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1857
        {
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1858
        TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1859
        OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_ISPUBLICPATH, "CThumbnailServer::IsPublicPath - NO" );
15
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1860
        return EFalse;
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1861
        }
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1862
    
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1863
    return ETrue;
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1864
    }
f0aa341a25bf Revision: 201020
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 14
diff changeset
  1865
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1866
// ---------------------------------------------------------------------------
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1867
// CThumbnailServer::StartUnmount()
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1868
// ---------------------------------------------------------------------------
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1869
//
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1870
void CThumbnailServer::StartUnmountTimeout( const TInt aDrive)
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1871
    {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1872
    TN_DEBUG2( "CThumbnailServer::StartUnmountTimeout(%d)", aDrive);
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1873
    OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_STARTUNMOUNTTIMEOUT, "CThumbnailServer::StartUnmountTimeout;aDrive=%d", aDrive );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1874
    
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1875
    if(iUnmount )
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1876
        {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1877
        if(iUnmountedDrives.Find( aDrive ) == KErrNotFound)
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1878
            {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1879
            iUnmountedDrives.Append( aDrive );
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1880
            }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1881
        
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1882
       if(iUnmount->IsActive())
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1883
           {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1884
           iUnmount->Cancel();
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1885
           }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1886
       
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1887
       TN_DEBUG1( "CThumbnailServer::StartUnmountTimeout() start unmount timer");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1888
       OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_STARTUNMOUNTTIMEOUT, "CThumbnailServer::StartUnmountTimeout - start unmount timer" );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1889
       iUnmount->Start( KUnmountTimerTimeout, KUnmountTimerTimeout, TCallBack(UnmountCallBack, this));
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1890
       }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1891
       __ASSERT_DEBUG(( iUnmount ), ThumbnailPanic( EThumbnailNullPointer ));
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1892
    }
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1893
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1894
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1895
// ---------------------------------------------------------------------------
19
f759b6186ab5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1896
// CThumbnailServer::UnmountCallBack()
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1897
// ---------------------------------------------------------------------------
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1898
//
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1899
TInt CThumbnailServer::UnmountCallBack(TAny* aAny)
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1900
    {
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1901
    TN_DEBUG1( "CThumbnailServer::UnmountCallBack() - unmount finished");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1902
    OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_UNMOUNTCALLBACK, "CThumbnailServer::UnmountCallBack - unmount finished" );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1903
    
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1904
    CThumbnailServer* self = static_cast<CThumbnailServer*>( aAny );
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1905
    
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1906
    self->iUnmount->Cancel();
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1907
    
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1908
    self->iUnmountedDrives.Reset();
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1909
    
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1910
    TN_DEBUG1( "CThumbAGDaemon::UnmountCallBack() - done");
21
6257223ede8a Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
  1911
    OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_UNMOUNTCALLBACK, "CThumbnailServer::UnmountCallBack - done" );
17
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1912
    
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1913
    return KErrNone;
ff2fb7658ff7 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1914
    }