upnpsharing/upnpcontentserver/src/upnpcontentserverhandler.cpp
author samhuttu
Mon, 01 Nov 2010 12:37:49 +0200
branchnew development branch with rendering state machine and other goodies
changeset 38 5360b7ddc251
parent 32 3785f754ee62
permissions -rw-r--r--
New development branch with e.g. rendering state machine and a simple Qt example application using it.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
     1
/*
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
     2
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
     3
* All rights reserved.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
     4
* This component and the accompanying materials are made available
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
     6
* which accompanies this distribution, and is available
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
     8
*
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
     9
* Initial Contributors:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    10
* Nokia Corporation - initial contribution.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    11
*
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    12
* Contributors:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    13
*
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    14
* Description:      Content sharing servers main scheduler function
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    15
 *
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    16
*/
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    17
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    18
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    19
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    20
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    21
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    22
#include <e32debug.h>
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    23
#include <e32property.h>
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    24
#include "upnpsharingalgorithmfactory.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    25
#include "upnpcdsliteobject.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    26
#include "upnpcdsliteobjectarray.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    27
#include <mclfitemlistmodel.h>
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    28
#include <escapeutils.h>            // ConvertFromUnicodeToUtf8L
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    29
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    30
#include "upnpcommonutils.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    31
#include "upnpcontentserverdefs.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    32
#include "upnpcontentserverhandler.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    33
#include "upnpselectionreader.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    34
#include "upnpcontentserverclient.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    35
#include "upnpcontentserver.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    36
#include "upnpcontentmetadatautility.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    37
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    38
_LIT( KComponentLogfile, "contentserver.txt");
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    39
#include "upnplog.h"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    40
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    41
// CONSTANTS
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    42
const TInt KNoProgress = -1;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    43
const TInt KZeroProgress = 0;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    44
const TInt KArrayGranularity = 10;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    45
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    46
_LIT8( KAudio, "audio" );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    47
_LIT8( KVideo, "video" );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    48
_LIT8( KImage, "image" );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    49
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    50
using namespace UpnpContentServer;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    51
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    52
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    53
// CUpnpContentServerHandler::NewL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    54
// 2-phased constructor.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    55
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    56
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    57
CUpnpContentServerHandler* CUpnpContentServerHandler::NewL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    58
    CUpnpContentServer* aServer )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    59
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    60
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    61
    CUpnpContentServerHandler* self =
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    62
        new (ELeave) CUpnpContentServerHandler( aServer );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    63
    CleanupStack::PushL(self);
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    64
    self->ConstructL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    65
    CleanupStack::Pop(); // self
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    66
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    67
    return self;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    68
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    69
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    70
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    71
// CUpnpContentServerHandler::CUpnpContentServerHandler()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    72
// C++ constructor.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    73
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    74
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    75
CUpnpContentServerHandler::CUpnpContentServerHandler(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    76
    CUpnpContentServer* aServer ) :
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    77
    iServer( aServer ),
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    78
    iContentSharingObserver( NULL ),
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    79
    iOngoingSharingType( KErrNotFound ),
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    80
    iErrorToClient( KErrNone ),
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    81
    iSharingAlgorithm( NULL )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    82
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    83
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    84
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    85
    ResetPendingRequestInfo();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    86
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    87
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    88
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    89
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    90
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    91
// CUpnpContentServerHandler::ConstructL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    92
// 2nd phase constructor.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    93
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    94
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    95
void CUpnpContentServerHandler::ConstructL()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    96
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    97
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    98
    static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    99
    static _LIT_SECURITY_POLICY_S0(KThisProcessPolicy,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   100
                                   KUpnpContentServerCat.iUid );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   101
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   102
    // define progress property to be a byte array, allocating mem
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   103
    TInt err = iProgressProperty.Define( KUpnpContentServerCat,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   104
                                         ESharingProgress,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   105
                                         RProperty::EByteArray,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   106
                                         KAllowAllPolicy,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   107
                                         KThisProcessPolicy,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   108
                                         sizeof( TUpnpProgress ) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   109
    if ( err != KErrNone )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   110
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   111
        __LOG1( "Error: %d", err );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   112
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   113
    if ( err!=KErrAlreadyExists )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   114
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   115
        User::LeaveIfError( err );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   116
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   117
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   118
    // Create selection reader
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   119
    iReader = CUpnpSelectionReader::NewL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   120
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   121
    // reset progress information
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   122
    SetProgressL( KNoProgress );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   123
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   124
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   125
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   126
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   127
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   128
// CUpnpContentServerHandler::InitializeL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   129
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   130
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   131
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   132
void CUpnpContentServerHandler::InitializeL()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   133
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   134
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   135
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   136
    // Create MUpnpSharingAlgorithm
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   137
    if ( !iSharingAlgorithm )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   138
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   139
        iSharingAlgorithm = 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   140
                CUPnPSharingAlgorithmFactory::NewSharingApiL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   141
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   142
    // Create CUpnpContentSharerAo
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   143
    if ( !iAo )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   144
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   145
        iAo = CUpnpContentSharerAo::NewL( this, iSharingAlgorithm );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   146
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   147
    // Create CUpnpContentMetadataUtility
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   148
    if ( !iMetadata )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   149
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   150
        iMetadata = CUpnpContentMetadataUtility::NewL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   151
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   152
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   153
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   154
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   155
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   156
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   157
// CUpnpContentServerHandler::~CUpnpContentServerHandler()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   158
// C++ destructor.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   159
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   160
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   161
CUpnpContentServerHandler::~CUpnpContentServerHandler()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   162
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   163
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   164
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   165
    if ( iSharingAlgorithm )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   166
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   167
        iSharingAlgorithm->Close();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   168
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   169
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   170
    delete iAo;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   171
    delete iMetadata;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   172
    delete iReader;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   173
    delete iMediaServer;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   174
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   175
    iPendingSharingReqInfo.iMarkedItems.Close();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   176
    delete iMusicSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   177
    delete iVisualSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   178
    iProgressProperty.Delete( KUpnpContentServerCat, ESharingProgress );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   179
    iProgressProperty.Close();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   180
    iServer = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   181
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   182
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   183
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   184
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   185
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   186
// CUpnpContentServerHandler::SetContentSharingObserverL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   187
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   188
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   189
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   190
void CUpnpContentServerHandler::SetContentSharingObserverL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   191
    MUpnpContentSharingObserver* aObserver )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   192
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   193
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   194
    iContentSharingObserver = aObserver; // can be NULL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   195
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   196
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   197
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   198
// CUpnpContentServerHandler::GetSelectionContentL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   199
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   200
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   201
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   202
void CUpnpContentServerHandler::GetSelectionContentL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   203
    const TInt& aContainerType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   204
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   205
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   206
    // There might be many containers -> 10 is OK for granularity
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   207
    CDesCArray* containers = 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   208
        new ( ELeave ) CDesCArrayFlat( KArrayGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   209
    CleanupStack::PushL( containers );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   210
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   211
    switch ( aContainerType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   212
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   213
        case EImageAndVideo :
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   214
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   215
            iReader->FetchCollectionsL( containers );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   216
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   217
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   218
        case EPlaylist :
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   219
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   220
            iReader->FetchPlaylistsL( containers );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   221
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   222
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   223
        default :
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   224
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   225
            CleanupStack::PopAndDestroy( containers );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   226
            __LOG1( "Error: %d", __LINE__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   227
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   228
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   229
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   230
    if ( iContentSharingObserver )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   231
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   232
        iContentSharingObserver->CompleteSelectionContentL( *containers );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   233
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   234
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   235
    CleanupStack::PopAndDestroy( containers );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   236
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   237
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   238
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   239
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   240
// CUpnpContentServerHandler::GetSelectionIndexesL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   241
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   242
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   243
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   244
void CUpnpContentServerHandler::GetSelectionIndexesL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   245
    RArray<TInt>& aMarkedItems,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   246
    const TInt aType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   247
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   248
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   249
    CUpnpSharingRequest* sharingReq( NULL );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   250
    switch ( aType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   251
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   252
        case EImageAndVideo :
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   253
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   254
            if ( iVisualSharingReq )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   255
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   256
                sharingReq = iVisualSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   257
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   258
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   259
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   260
        case EPlaylist :
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   261
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   262
            if ( iMusicSharingReq )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   263
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   264
                sharingReq = iMusicSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   265
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   266
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   267
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   268
        default :
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   269
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   270
            __LOG1( "Error: %d", __LINE__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   271
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   272
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   273
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   274
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   275
    if ( sharingReq && 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   276
        sharingReq->iClfIds && 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   277
        sharingReq->iSharingType == EShareMany )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   278
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   279
        // There is sharing ongoing, return the buffered selections
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   280
        for( TInt i(0); i < sharingReq->iClfIds->MdcaCount(); i++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   281
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   282
            TInt index = iReader->GetSelectionIndexL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   283
                    (TUpnpMediaType)aType, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   284
                    sharingReq->iClfIds->MdcaPoint( i ) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   285
            if ( index != KErrNotFound )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   286
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   287
                aMarkedItems.AppendL( index );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   288
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   289
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   290
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   291
    else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   292
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   293
        if ( !iReader )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   294
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   295
            __LOG1( "Error: %d", __LINE__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   296
            iReader = CUpnpSelectionReader::NewL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   297
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   298
        iReader->GetSelectionIndexesL( aMarkedItems, (TUpnpMediaType)aType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   299
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   300
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   301
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   302
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   303
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   304
// CUpnpContentServerHandler::ChangeShareContentL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   305
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   306
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   307
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   308
void CUpnpContentServerHandler::ChangeShareContentL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   309
    const RArray<TInt>& aMarkedItems,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   310
    const TInt aType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   311
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   312
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   313
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   314
    for( TInt e(0); e<aMarkedItems.Count();e++)
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   315
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   316
        __LOG2("CUpnpContentServerHandler: received index[%d] = %d",
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   317
            e, aMarkedItems[e] );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   318
        }    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   319
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   320
    if ( iOngoingSharingType != KErrNotFound )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   321
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   322
        // sharing process ongoing, check that if selection is changed
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   323
        // to ongoing sharing type
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   324
        if ( aType == iOngoingSharingType && iAo->SharingOngoing() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   325
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   326
            // save pending request info
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   327
            SavePendingRequestInfoL( aMarkedItems, aType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   328
            // cancel Ao and create new sharing request in callback
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   329
            iAo->StopSharing();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   330
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   331
        else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   332
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   333
            SetSharingRequestL( aMarkedItems, aType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   334
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   335
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   336
    else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   337
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   338
        // Not active, ie. no sharing ongoing        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   339
        SetSharingRequestL( aMarkedItems, aType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   340
        iOngoingSharingType = aType;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   341
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   342
        // start the sharing
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   343
        DoShare();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   344
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   345
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   346
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   347
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   348
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   349
// CUpnpContentServerHandler::RefreshShareContentL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   350
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   351
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   352
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   353
void CUpnpContentServerHandler::RefreshShareContentL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   354
    TInt aType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   355
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   356
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   357
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   358
    if ( ( aType == EImageAndVideo && iVisualSharingReq ) ||
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   359
         ( aType == EPlaylist && iMusicSharingReq ) )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   360
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   361
        // no refresh available if sharing is ongoing
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   362
        __LOG1( "Error: %d", __LINE__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   363
        User::Leave( KErrServerBusy );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   364
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   365
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   366
    delete iReader;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   367
    iReader = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   368
    iReader = CUpnpSelectionReader::NewL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   369
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   370
    if ( aType == EImageAndVideo )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   371
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   372
        RArray<TInt> markedItems;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   373
        CleanupClosePushL( markedItems );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   374
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   375
        // Get selected indexes and create new sharing request
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   376
        GetSelectionIndexesL( markedItems, aType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   377
        SetSharingRequestL( markedItems, aType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   378
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   379
        CleanupStack::PopAndDestroy( &markedItems );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   380
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   381
    else if ( aType == EPlaylist )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   382
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   383
        RArray<TInt> markedItems;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   384
        CleanupClosePushL( markedItems );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   385
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   386
        // Get selected indexes and create new sharing request
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   387
        GetSelectionIndexesL( markedItems, aType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   388
        SetSharingRequestL( markedItems, aType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   389
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   390
        CleanupStack::PopAndDestroy( &markedItems );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   391
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   392
    else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   393
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   394
        User::Leave( KErrArgument );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   395
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   396
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   397
    // if no refreshes ongoing, start sharing
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   398
    if ( iOngoingSharingType == KErrNotFound )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   399
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   400
        iOngoingSharingType = aType;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   401
        DoShare();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   402
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   403
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   404
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   405
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   406
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   407
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   408
// CUpnpContentServerHandler::CanStop
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   409
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   410
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   411
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   412
TBool CUpnpContentServerHandler::CanStop() const
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   413
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   414
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   415
    TBool ret( EFalse );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   416
    if ( !( iVisualSharingReq || iMusicSharingReq  ) )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   417
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   418
        __LOG("CUpnpContentServerHandler: CanStop(): 1");
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   419
        ret = ETrue;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   420
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   421
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   422
    return ret;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   423
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   424
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   425
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   426
// CUpnpContentServerHandler::CompleteSharingOperationL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   427
// This should be called from active objects owned by handler
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   428
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   429
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   430
void CUpnpContentServerHandler::CompleteSharingOperationL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   431
    const TInt& aErr, const TInt& aType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   432
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   433
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   434
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   435
    switch ( aErr )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   436
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   437
        case KErrNone:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   438
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   439
            iErrorToClient = KErrNone;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   440
            if ( aType == EImageAndVideo )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   441
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   442
                // Reset sharing request object 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   443
                delete iVisualSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   444
                iVisualSharingReq = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   445
                
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   446
                // If there is pending music request, process it next 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   447
                if ( iMusicSharingReq )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   448
                    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   449
                    iOngoingSharingType = EPlaylist;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   450
                    DoShare();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   451
                    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   452
                else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   453
                    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   454
                    iOngoingSharingType = KErrNotFound;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   455
                    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   456
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   457
            else if ( aType == EPlaylist )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   458
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   459
                // Reset sharing request object 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   460
                delete iMusicSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   461
                iMusicSharingReq = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   462
                
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   463
                // If there is pending music request, process it next 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   464
                if ( iVisualSharingReq )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   465
                    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   466
                    iOngoingSharingType = EImageAndVideo;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   467
                    DoShare();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   468
                    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   469
                else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   470
                    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   471
                    iOngoingSharingType = KErrNotFound;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   472
                    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   473
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   474
            else 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   475
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   476
                iOngoingSharingType = KErrNotFound;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   477
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   478
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   479
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   480
        case KErrCancel:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   481
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   482
            // User reselected currently ongoing sharing, handle it next
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   483
            if ( iPendingSharingReqInfo.iMarkedItems.Count() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   484
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   485
                // create sharing request from pending info
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   486
                TRAPD( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   487
                    err, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   488
                    SetSharingRequestL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   489
                        iPendingSharingReqInfo.iMarkedItems,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   490
                        iPendingSharingReqInfo.iMediaType ) 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   491
                    );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   492
                if ( err )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   493
                    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   494
                    HandleError( err );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   495
                    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   496
                else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   497
                    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   498
                    // no errors, reset the pending request info and start 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   499
                    // sharing
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   500
                    ResetPendingRequestInfo();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   501
                    DoShare();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   502
                    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   503
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   504
            else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   505
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   506
                iOngoingSharingType = KErrNotFound;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   507
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   508
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   509
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   510
        default:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   511
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   512
            __LOG1( "CompleteSharingOperationL: %d", aErr );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   513
            HandleError( aErr );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   514
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   515
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   516
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   517
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   518
    if ( iOngoingSharingType == KErrNotFound )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   519
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   520
        // Reset the progress info to no progress.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   521
        TRAP_IGNORE( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   522
            SetProgressL( KNoProgress )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   523
            );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   524
        if ( CanStop() && iServer && !iContentSharingObserver )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   525
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   526
            // client application is exited, no sharing ongoing
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   527
            // -> stop the server
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   528
            iServer->Stop();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   529
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   530
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   531
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   532
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   533
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   534
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   535
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   536
// CUpnpContentServerHandler::CancelSharingOperationL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   537
// This should be called from active objects owned by handler
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   538
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   539
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   540
void CUpnpContentServerHandler::CancelSharingOperationL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   541
    const TInt& /*aErr*/ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   542
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   543
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   544
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   545
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   546
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   547
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   548
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   549
// CUpnpContentServerHandler::SetProgressL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   550
// This should be called from active objects owned by handler
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   551
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   552
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   553
void CUpnpContentServerHandler::SetProgressL( const TInt& aProgress )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   554
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   555
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   556
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   557
    // Initilialize music sharing progress information
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   558
    TUpnpProgressInfo playlistProg;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   559
    playlistProg.iProgress = KZeroProgress;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   560
    playlistProg.iProgressKind = EPlaylist;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   561
    playlistProg.iProgressType = TUpnpProgressInfo::EVisualStatus;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   562
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   563
    // Set music sharing progress information
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   564
    if ( iMusicSharingReq && aProgress != KNoProgress )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   565
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   566
        playlistProg.iProgressType = TUpnpProgressInfo::ESharingProgress;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   567
        if ( iOngoingSharingType == EPlaylist )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   568
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   569
            playlistProg.iProgress = aProgress;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   570
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   571
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   572
    else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   573
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   574
        TInt state( EShareNone );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   575
        iReader->GetMusicSharingStateL( state );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   576
        playlistProg.iProgress = state;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   577
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   578
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   579
    // Initilialize visual sharing progress information
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   580
    TUpnpProgressInfo visualProg;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   581
    visualProg.iProgress = KZeroProgress;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   582
    visualProg.iProgressKind = EImageAndVideo;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   583
    visualProg.iProgressType = TUpnpProgressInfo::EVisualStatus;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   584
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   585
    // Set visual sharing progress information
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   586
    if ( iVisualSharingReq && aProgress != KNoProgress )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   587
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   588
        visualProg.iProgressType = TUpnpProgressInfo::ESharingProgress;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   589
        if ( iOngoingSharingType == EImageAndVideo)
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   590
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   591
            visualProg.iProgress = aProgress;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   592
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   593
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   594
    else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   595
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   596
        TInt state( EShareNone );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   597
        iReader->GetVisualSharingStateL( state );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   598
        visualProg.iProgress = state;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   599
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   600
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   601
    // Create total progress
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   602
    TUpnpProgress totalProg;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   603
    totalProg.iError = iErrorToClient;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   604
    iErrorToClient = KErrNone;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   605
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   606
    totalProg.iImageVideoProgress = visualProg;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   607
    totalProg.iMusicProgress = playlistProg;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   608
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   609
    // Set the progress property so that Ui updates itself
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   610
    TPckgBuf<TUpnpProgress> progressBuf( totalProg );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   611
    TInt err = iProgressProperty.Set( KUpnpContentServerCat,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   612
                                      ESharingProgress,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   613
                                      progressBuf  );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   614
    if ( err != KErrNone )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   615
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   616
        __LOG1( "Error: %d", err );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   617
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   618
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   619
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   620
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   621
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   622
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   623
// CUpnpContentServerHandler::DoShare
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   624
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   625
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   626
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   627
void CUpnpContentServerHandler::DoShare()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   628
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   629
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   630
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   631
    switch( iOngoingSharingType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   632
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   633
        case EImageAndVideo :
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   634
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   635
            // start sharing and put progress
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   636
            iAo->StartSharing( iVisualSharingReq );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   637
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   638
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   639
        case EPlaylist :
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   640
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   641
            // start sharing and put progress
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   642
            iAo->StartSharing( iMusicSharingReq );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   643
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   644
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   645
        default:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   646
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   647
            __LOG1( "Error: %d", __LINE__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   648
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   649
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   650
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   651
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   652
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   653
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   654
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   655
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   656
// CUpnpContentServerHandler::Cleanup
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   657
// Cleanup depending on state
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   658
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   659
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   660
void CUpnpContentServerHandler::Cleanup()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   661
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   662
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   663
    if( iAo->SharingOngoing() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   664
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   665
        iAo->StopSharing();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   666
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   667
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   668
    delete iVisualSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   669
    iVisualSharingReq = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   670
    delete iMusicSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   671
    iMusicSharingReq = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   672
    ResetPendingRequestInfo();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   673
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   674
    // reset state variables
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   675
    iOngoingSharingType = KErrNotFound;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   676
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   677
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   678
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   679
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   680
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   681
// CUpnpContentServerHandler::ConnectionLost
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   682
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   683
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   684
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   685
TBool CUpnpContentServerHandler::ConnectionLostL( )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   686
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   687
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   688
    TBool ret( EFalse );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   689
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   690
    if ( iOngoingSharingType != KErrNotFound )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   691
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   692
        ret = ETrue;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   693
        if ( iAo->SharingOngoing() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   694
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   695
            iAo->StopSharing();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   696
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   697
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   698
    else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   699
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   700
        TInt err( iMediaServer->Connect() );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   701
        TInt stat( RUpnpMediaServerClient::EStopped );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   702
        if ( !err )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   703
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   704
            err = iMediaServer->Status( stat );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   705
            if ( !err && stat == RUpnpMediaServerClient::EStartedOnline )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   706
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   707
                iMediaServer->Stop( RUpnpMediaServerClient::EStopSilent );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   708
                iMediaServer->Close();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   709
                delete iMediaServer;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   710
                iMediaServer = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   711
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   712
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   713
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   714
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   715
    return ret;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   716
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   717
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   718
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   719
// CUpnpContentServerHandler::SetSharingRequestL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   720
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   721
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   722
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   723
void CUpnpContentServerHandler::SetSharingRequestL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   724
    const RArray<TInt>& aMarkedItems,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   725
    const TInt aType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   726
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   727
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   728
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   729
    // Create sharing request
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   730
    CreateSharingRequestL( aType, SharingType( aMarkedItems ) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   731
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   732
    // Get user selected filenames to be shared
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   733
    CDesCArray* filenamesToBeShared = 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   734
        new (ELeave) CDesCArrayFlat( KArrayGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   735
    CleanupStack::PushL( filenamesToBeShared );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   736
    CDesCArray* clfIds =
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   737
        new (ELeave) CDesCArrayFlat( KArrayGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   738
    CleanupStack::PushL( clfIds );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   739
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   740
    GetSelectionFilenamesL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   741
            aMarkedItems, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   742
            aType, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   743
            SharingType( aMarkedItems ), 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   744
            *filenamesToBeShared,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   745
            *clfIds );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   746
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   747
    // Get currently shared filenames
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   748
    CUpnpCdsLiteObjectArray& currentlySharedContent = 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   749
        iSharingAlgorithm->ReadSharedContent();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   750
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   751
    // Compare and create unshare/share arrays
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   752
    RArray<TFileName>* shareArr = new ( ELeave ) RArray<TFileName>;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   753
    CleanupStack::PushL( shareArr );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   754
    RArray<TFileName>* unshareArr = new ( ELeave ) RArray<TFileName>;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   755
    CleanupStack::PushL( unshareArr );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   756
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   757
    CompareCdsToClfL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   758
            *filenamesToBeShared, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   759
            currentlySharedContent,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   760
            *shareArr,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   761
            *unshareArr,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   762
            (TUpnpMediaType)aType );    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   763
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   764
    // Set sharing request information arrays:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   765
    // shareArr, unshareArr and clfIds ownership transferred.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   766
    SetSharingRequestInfo( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   767
        aType, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   768
        shareArr, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   769
        unshareArr, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   770
        clfIds );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   771
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   772
    // cleanup
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   773
    CleanupStack::Pop( unshareArr ); // ownership transferred to shar.request
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   774
    CleanupStack::Pop( shareArr );   // ownership transferred to shar.request
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   775
    CleanupStack::Pop( clfIds );     // ownership transferred to shar.request
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   776
    CleanupStack::PopAndDestroy( filenamesToBeShared );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   777
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   778
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   779
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   780
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   781
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   782
// CUpnpContentServerHandler::HandleError
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   783
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   784
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   785
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   786
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   787
void CUpnpContentServerHandler::HandleError( TInt aError )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   788
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   789
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   790
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   791
    // cleanup if some error occurred while sharing
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   792
    if( iOngoingSharingType != KErrNotFound )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   793
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   794
        Cleanup();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   795
        iErrorToClient = aError;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   796
        // reset progress information
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   797
        TRAP_IGNORE( SetProgressL( KNoProgress ) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   798
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   799
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   800
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   801
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   802
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   803
// CUpnpContentServerHandler::GetSelectionFilenamesL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   804
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   805
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   806
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   807
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   808
void CUpnpContentServerHandler::GetSelectionFilenamesL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   809
    const RArray<TInt>& aMarkedItems,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   810
    const TInt aType,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   811
    const TInt aSharingType,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   812
    CDesCArray& aFilenames,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   813
    CDesCArray& aClfIds )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   814
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   815
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   816
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   817
    // Collect all the necessary filenames and clfIds depending on 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   818
    // the user selection.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   819
    switch ( aSharingType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   820
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   821
        case EShareAll:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   822
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   823
            // All files of the selected playlists/albums should be 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   824
            // shared
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   825
            if ( aType == EImageAndVideo )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   826
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   827
                GetAllImageAndVideoFilenamesL( aFilenames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   828
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   829
            else if ( aType == EPlaylist )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   830
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   831
                GetAllMusicFilenamesL( aFilenames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   832
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   833
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   834
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   835
        case EShareMany:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   836
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   837
            // Selected some of the playlists/albums
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   838
            if ( aType == EImageAndVideo )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   839
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   840
                GetSelectedImgAndVideoFilenamesL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   841
                    aMarkedItems, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   842
                    aFilenames,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   843
                    aClfIds );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   844
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   845
            else if ( aType == EPlaylist )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   846
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   847
                GetSelectedMusicFilenamesL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   848
                    aMarkedItems,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   849
                    aFilenames,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   850
                    aClfIds );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   851
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   852
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   853
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   854
        case EShareNone:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   855
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   856
            // No selections, do nothing
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   857
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   858
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   859
        default:
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   860
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   861
            // do nothing
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   862
            break;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   863
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   864
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   865
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   866
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   867
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   868
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   869
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   870
// CUpnpContentServerHandler::GetAllImageAndVideoFilenamesL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   871
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   872
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   873
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   874
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   875
void CUpnpContentServerHandler::GetAllImageAndVideoFilenamesL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   876
    CDesCArray& aFilenames )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   877
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   878
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   879
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   880
    // Fetch all the image files
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   881
    const MCLFItemListModel* imageFiles = iMetadata->ImageFiles();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   882
    if ( imageFiles )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   883
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   884
        TInt imageCount = imageFiles->ItemCount();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   885
        __LOG1( "CUpnpContentServerHandler::GetAllImageAndVideoFilenamesL \
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   886
                    imageCount=%d", imageCount );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   887
                    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   888
        // Append all image files to aFilenames
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   889
        for ( TInt i=0; i < imageCount; i++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   890
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   891
            // get the filename from clf item
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   892
            TPtrC fullFilename;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   893
            imageFiles->Item(i).GetField( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   894
                ECLFFieldIdFileNameAndPath,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   895
                fullFilename );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   896
            aFilenames.AppendL( fullFilename );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   897
            }    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   898
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   899
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   900
    // Fetch all the video files
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   901
    const MCLFItemListModel* videoFiles = iMetadata->VideoFiles();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   902
    if ( videoFiles )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   903
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   904
        TInt videoCount = videoFiles->ItemCount();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   905
        __LOG1( "CUpnpContentServerHandler::GetAllImageAndVideoFilenamesL \
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   906
                    videoCount=%d", videoCount );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   907
                    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   908
        // Append all video files to aFilenames
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   909
        for ( TInt i=0; i < videoCount; i++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   910
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   911
            // get the filename from clf item
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   912
            TPtrC fullFilename;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   913
            videoFiles->Item(i).GetField( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   914
                ECLFFieldIdFileNameAndPath,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   915
                fullFilename );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   916
            aFilenames.AppendL( fullFilename );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   917
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   918
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   919
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   920
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   921
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   922
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   923
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   924
// CUpnpContentServerHandler::GetAllMusicFilenamesL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   925
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   926
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   927
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   928
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   929
void CUpnpContentServerHandler::GetAllMusicFilenamesL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   930
    CDesCArray& aFilenames )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   931
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   932
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   933
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   934
    // Fetch all the music files...
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   935
    const MCLFItemListModel* musicFiles = iMetadata->MusicFiles();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   936
    if ( musicFiles )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   937
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   938
        TInt musicCount = musicFiles->ItemCount();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   939
        __LOG1( "CUpnpContentServerHandler::GetAllMusicFilenamesL \
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   940
                    musicCount=%d", musicCount );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   941
                    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   942
        // Append all music files to aFilenames
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   943
        for ( TInt i=0; i < musicCount; i++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   944
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   945
            // get the filename from clf item
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   946
            TPtrC fullFilename;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   947
            musicFiles->Item(i).GetField( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   948
                ECLFFieldIdFileNameAndPath,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   949
                fullFilename );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   950
            aFilenames.AppendL( fullFilename );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   951
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   952
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   953
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   954
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   955
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   956
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   957
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   958
// CUpnpContentServerHandler::GetSelectedImgAndVideoFilenamesL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   959
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   960
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   961
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   962
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   963
void CUpnpContentServerHandler::GetSelectedImgAndVideoFilenamesL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   964
    const RArray<TInt>& aMarkedItems,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   965
    CDesCArray& aFilenames,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   966
    CDesCArray& aClfIds )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   967
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   968
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   969
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   970
    // Go though all the selected collections and fetch collection ids and 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   971
    // items.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   972
    TInt markedCount = aMarkedItems.Count();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   973
    for ( TInt i=0; i < markedCount; i++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   974
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   975
        CDesCArray* collFilenames = 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   976
            new (ELeave) CDesCArrayFlat( KArrayGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   977
        CleanupStack::PushL( collFilenames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   978
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   979
        // find out collection id and items
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   980
        TPtrC collId = iReader->GetCollectionItemsL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   981
                            aMarkedItems[i], 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   982
                            *collFilenames );        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   983
        if ( collId.Length() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   984
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   985
            // collection id found, append it to aClfIds
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   986
            aClfIds.AppendL( collId );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   987
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   988
            // append all collection items to aFilenames
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   989
            TInt collFileCount = collFilenames->Count();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   990
            for (TInt j=0; j < collFileCount; j++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   991
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   992
                aFilenames.AppendL( collFilenames->MdcaPoint( j ) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   993
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   994
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   995
        CleanupStack::PopAndDestroy( collFilenames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   996
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   997
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   998
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   999
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1000
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1001
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1002
// CUpnpContentServerHandler::GetSelectedMusicFilenamesL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1003
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1004
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1005
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1006
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1007
void CUpnpContentServerHandler::GetSelectedMusicFilenamesL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1008
    const RArray<TInt>& aMarkedItems,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1009
    CDesCArray& aFilenames,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1010
    CDesCArray& aClfIds )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1011
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1012
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1013
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1014
    // Go though all the selected playlists and fetch playlist ids and 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1015
    // items.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1016
    TInt markedCount = aMarkedItems.Count();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1017
    for ( TInt i=0; i < markedCount; i++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1018
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1019
        CDesCArray* plFilenames = 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1020
            new (ELeave) CDesCArrayFlat( KArrayGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1021
        CleanupStack::PushL( plFilenames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1022
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1023
        // find out playlist id and items
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1024
        TPtrC plId = iReader->GetPlaylistItemsL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1025
                            aMarkedItems[i],
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1026
                            *plFilenames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1027
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1028
        if ( plId.Length() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1029
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1030
            // playlist id found, append it to aClfIds
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1031
            aClfIds.AppendL( plId );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1032
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1033
            // append all playlist items to aFilenames
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1034
            TInt plFileCount = plFilenames->Count();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1035
            for (TInt j=0; j < plFileCount; j++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1036
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1037
                aFilenames.AppendL( plFilenames->MdcaPoint( j ) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1038
                }            
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1039
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1040
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1041
        CleanupStack::PopAndDestroy( plFilenames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1042
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1043
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1044
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1045
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1046
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1047
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1048
// CUpnpContentServerHandler::CompareCdsToClfL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1049
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1050
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1051
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1052
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1053
void CUpnpContentServerHandler::CompareCdsToClfL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1054
    CDesCArray& aClfFilePaths, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1055
    CUpnpCdsLiteObjectArray& aCdsObjects,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1056
    RArray<TFileName>& aToBeSharedFiles,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1057
    RArray<TFileName>& aToBeUnsharedSharedFiles,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1058
    const TUpnpMediaType aType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1059
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1060
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1061
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1062
    // See if files in the clffilenames can be found from cds structure.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1063
    // if they cna they are already shared. In they can't they need to be 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1064
    // added to the list of "to be shared" items.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1065
    for (TInt i(0); i<aClfFilePaths.MdcaCount(); i++)
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1066
        {        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1067
        RBuf8 fileName;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1068
        CleanupClosePushL( fileName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1069
        fileName.CreateMaxL( aClfFilePaths.MdcaPoint(i).Length() );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1070
        fileName.Copy( aClfFilePaths.MdcaPoint(i) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1071
        if(  KErrNotFound == aCdsObjects.FindByName( fileName ))
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1072
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1073
            // Not found cds-structure, so needs to be added to 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1074
            // toBeSharedFiles.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1075
            aToBeSharedFiles.AppendL( aClfFilePaths.MdcaPoint(i) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1076
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1077
        else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1078
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1079
            // Shared already
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1080
            }    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1081
        CleanupStack::PopAndDestroy( &fileName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1082
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1083
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1084
    // See if items in cds structure can be found from clffilenames. If 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1085
    // they are found they need to be shared. If they are not found they 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1086
    // need to be added to the list of "to be unshared" items.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1087
    for ( TInt j( 0 ); j<aCdsObjects.Count(); j++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1088
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1089
        CUpnpCdsLiteObject& cdsObject = aCdsObjects.ObjectAtL( j );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1090
        // resolve filetype in cds
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1091
        const TDesC8& itemType = cdsObject.ObjectClass(); 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1092
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1093
        // compare only right type
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1094
        if ( cdsObject.Type() == CUpnpCdsLiteObject::EItem && 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1095
            ( ( ( itemType.Find( KVideo ) != KErrNotFound || 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1096
                itemType.Find( KImage ) != KErrNotFound ) &&
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1097
                aType == EImageAndVideo ) || 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1098
            ( itemType.Find( KAudio ) != KErrNotFound && 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1099
                aType == EPlaylist ) ) )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1100
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1101
            // get filename
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1102
            HBufC* fileName = EscapeUtils::ConvertToUnicodeFromUtf8L( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1103
                cdsObject.Name() );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1104
            CleanupStack::PushL( fileName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1105
            
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1106
            TInt clfCount = aClfFilePaths.Count();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1107
            TInt clfIndex( KErrNotFound );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1108
            aClfFilePaths.Find( *fileName, clfIndex );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1109
            if ( clfCount < 1 || clfIndex >= clfCount )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1110
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1111
                // Must not be shared so add to the toBeUnsharedSharedFiles.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1112
                aToBeUnsharedSharedFiles.AppendL( *fileName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1113
                }            
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1114
            else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1115
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1116
                // Sharing wanted to that item
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1117
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1118
            CleanupStack::PopAndDestroy( fileName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1119
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1120
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1121
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1122
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1123
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1124
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1125
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1126
// CUpnpContentServerHandler::CreateSharingRequestL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1127
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1128
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1129
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1130
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1131
void CUpnpContentServerHandler::CreateSharingRequestL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1132
    TInt aType, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1133
    TInt aSharingType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1134
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1135
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1136
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1137
    // flag for indicating is it needed to set progress property
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1138
    TBool setProgress( EFalse );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1139
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1140
    // Create the appropriate request depending on the sharing type.    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1141
    if ( aType == EImageAndVideo )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1142
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1143
        // if music sharing is not ongoing, set progress
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1144
        if ( !iMusicSharingReq || iOngoingSharingType != EPlaylist )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1145
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1146
            setProgress = ETrue;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1147
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1148
        else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1149
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1150
            // force AO to set progress as soon as possible
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1151
            iAo->ForceSetProgress();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1152
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1153
            
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1154
        // create image and video request 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1155
        delete iVisualSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1156
        iVisualSharingReq = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1157
        iVisualSharingReq = CUpnpSharingRequest::NewL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1158
                                                    (TUpnpMediaType)aType, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1159
                                                    aSharingType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1160
        if ( setProgress )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1161
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1162
            // set progress so that ui updates itself
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1163
            SetProgressL( KZeroProgress );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1164
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1165
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1166
    else if ( aType == EPlaylist )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1167
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1168
        // if visual sharing is not ongoing, set progress
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1169
        if ( !iVisualSharingReq || iOngoingSharingType != EImageAndVideo )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1170
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1171
            setProgress = ETrue;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1172
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1173
        else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1174
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1175
            // force AO to set progress as soon as possible
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1176
            iAo->ForceSetProgress();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1177
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1178
            
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1179
        // create music request 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1180
        delete iMusicSharingReq;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1181
        iMusicSharingReq = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1182
        iMusicSharingReq = CUpnpSharingRequest::NewL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1183
                                                    (TUpnpMediaType)aType, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1184
                                                    aSharingType );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1185
        if ( setProgress )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1186
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1187
            // set progress so that ui updates itself
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1188
            SetProgressL( KZeroProgress );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1189
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1190
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1191
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1192
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1193
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1194
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1195
// CUpnpContentServerHandler::SetSharingRequestInfo
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1196
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1197
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1198
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1199
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1200
void CUpnpContentServerHandler::SetSharingRequestInfo(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1201
    TInt aType, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1202
    RArray<TFileName>* aShareArray,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1203
    RArray<TFileName>* aUnshareArray,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1204
    CDesCArray* aClfIds )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1205
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1206
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1207
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1208
    // Sets the appropriate sharing request information arrays.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1209
    // aShareArray, UnshareArray and aClfIds ownership transferred.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1210
    if ( aType == EImageAndVideo && iVisualSharingReq )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1211
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1212
        // image and video request 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1213
        iVisualSharingReq->SetSharingRequestInfo(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1214
            aShareArray,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1215
            aUnshareArray,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1216
            aClfIds );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1217
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1218
    else if ( aType == EPlaylist && iMusicSharingReq )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1219
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1220
        // music request 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1221
        iMusicSharingReq->SetSharingRequestInfo(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1222
            aShareArray,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1223
            aUnshareArray,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1224
            aClfIds );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1225
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1226
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1227
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1228
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1229
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1230
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1231
// CUpnpContentServerHandler::ResetPendingRequestInfo
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1232
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1233
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1234
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1235
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1236
void CUpnpContentServerHandler::ResetPendingRequestInfo()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1237
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1238
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1239
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1240
    // Reset iPendingSharingReqInfo object
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1241
    iPendingSharingReqInfo.iMediaType = KErrNotFound;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1242
    iPendingSharingReqInfo.iMarkedItems.Reset();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1243
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1244
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1245
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1246
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1247
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1248
// CUpnpContentServerHandler::SavePendingRequestInfoL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1249
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1250
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1251
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1252
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1253
void CUpnpContentServerHandler::SavePendingRequestInfoL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1254
    const RArray<TInt>& aMarkedItems,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1255
    const TInt aType )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1256
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1257
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1258
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1259
    // reset pending request object
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1260
    ResetPendingRequestInfo();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1261
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1262
    // Fill info of pending sharing request
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1263
    iPendingSharingReqInfo.iMediaType = aType;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1264
    for ( TInt i = 0; i < aMarkedItems.Count(); i++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1265
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1266
        iPendingSharingReqInfo.iMarkedItems.AppendL( aMarkedItems[i] );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1267
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1268
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1269
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1270
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1271
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1272
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1273
// CUpnpContentServerHandler::ResolveSharingType
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1274
// ( other items are commented in header )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1275
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1276
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1277
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1278
TInt CUpnpContentServerHandler::SharingType( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1279
    const RArray<TInt>& aMarkedItems )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1280
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1281
    // Resolve sharing type
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1282
    TInt sharingType( EShareMany );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1283
    if ( aMarkedItems.Find(0) != KErrNotFound )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1284
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1285
        // share nothing marked
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1286
        sharingType = EShareNone;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1287
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1288
    else if ( aMarkedItems.Find(1) != KErrNotFound )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1289
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1290
        // share all marked
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1291
        sharingType = EShareAll;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1292
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1293
    return sharingType;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1294
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1295
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
  1296
// End of file