upnpsharing/upnpcontentserver/src/upnpselectionreader.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) 2005-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:      CUpnpSelectionReader class implementation
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
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 FILES
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    24
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 <upnpstring.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 <s32file.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 <centralrepository.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 <clfcontentlistingextended.hrh>
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 <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
    31
#include <MCLFItem.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 "upnpcontentservercrkeys.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 "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
    35
#include "upnpplaylistservices.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 "upnpalbumservices.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
// Format string for listbox items
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    43
_LIT(KItemFormatString, "1\t%S");
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 KDefaultStringArrGranularity( 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
const TInt KDefaultSelectionGranularity( 2 );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    46
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    47
const TInt KShareNoneIndex = 0;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    48
const TInt KShareAllIndex = 1;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    49
const TInt KPredefinedSelections = 2; // Share none and share all
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    50
const TInt KUiSelectionOffset = 2;
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
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
    53
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    54
// ================= MEMBER FUNCTIONS =======================
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
// 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
    58
// Two-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
    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
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    61
EXPORT_C CUpnpSelectionReader* 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
    62
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    63
    __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
    64
    CUpnpSelectionReader* self =
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    65
        new(ELeave) CUpnpSelectionReader();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    66
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    67
    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
    68
    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
    69
    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
    70
    __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
    71
    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
    72
    }
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
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    76
// CUpnpSelectionReader::ConstructL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    77
// Symbian 2nd phase constructor can leave.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    78
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    79
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    80
void CUpnpSelectionReader::ConstructL()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    81
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    82
    __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
    83
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    84
    iPlIdArray = new (ELeave) CDesCArrayFlat( KDefaultStringArrGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    85
    iCollIdArray = new (ELeave) 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    86
        CDesCArrayFlat( KDefaultStringArrGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    87
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    88
    iPlaylistNames = new (ELeave) 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    89
        CDesCArrayFlat( KDefaultStringArrGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    90
    iCollectionNames = new (ELeave) 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    91
        CDesCArrayFlat( KDefaultStringArrGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    92
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    93
    iSelectedImages  = new (ELeave) RArray<TInt>( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    94
        KDefaultSelectionGranularity);
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    95
    iSelectedMusic  = new (ELeave) RArray<TInt>( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    96
        KDefaultSelectionGranularity);
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    97
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    98
    GetVisualSharingStateL( iVisualSharingSelection );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
    99
    GetMusicSharingStateL( iMusicSharingSelection );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   100
    __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
   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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   103
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   104
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   105
// CUpnpSelectionReader::CUpnpSelectionReader
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   106
// C++ default constructor can NOT contain any code, that
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   107
// might leave.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   108
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   109
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   110
CUpnpSelectionReader::CUpnpSelectionReader()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   111
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   112
    __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
   113
    iImageContainers = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   114
    iPlaylistNames = NULL;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   115
    __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
   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
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   119
// CUpnpSelectionReader::~CUpnpSelectionReader
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   120
// C++ default destructor.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   121
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   122
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   123
CUpnpSelectionReader::~CUpnpSelectionReader()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   124
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   125
    __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
   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
    if ( iSelectedImages )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   128
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   129
        iSelectedImages->Close();
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
    delete iSelectedImages;
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
    if ( iSelectedMusic )
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
        iSelectedMusic->Close();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   137
        }
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
    delete iSelectedMusic;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   140
    delete iPlIdArray;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   141
    delete iCollIdArray;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   142
    delete iPlaylistNames;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   143
    delete iImageContainers;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   144
    delete iCollectionNames;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   145
    __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
   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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   148
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   149
// CUpnpSelectionReader::IsItemSharedL()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   150
// Checks if album is shared earlier
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
TBool CUpnpSelectionReader::IsItemShared(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   154
            const TDesC& aItemName,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   155
            const CDesCArray& aIDArray ) const
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
    __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
   158
    TInt pos;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   159
    TBool retVal = !aIDArray.Find( aItemName, pos );
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
    __LOG1( "CUpnpSelectionReader::IsItemSharedL returns %d",
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   162
        retVal );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   163
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   164
    __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
   165
    return retVal;
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
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
// CUpnpSelectionReader::FetchCollectionsL()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   171
// Fetch albums from Media Gallery for the listbox
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   172
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   173
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   174
void CUpnpSelectionReader::FetchCollectionsL( CDesCArray* 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   175
                                              aSettingsTextArray )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   176
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   177
    __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
   178
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   179
    if ( !aSettingsTextArray )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   180
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   181
        User::Leave( KErrGeneral );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   182
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   183
    // This is for IsItemSharedL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   184
    iMediaType = EImageAndVideo;
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
    if( iSelectedImages )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   187
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   188
        iSelectedImages->Reset();
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
    if( iCollIdArray )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   191
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   192
        iCollIdArray->Reset();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   193
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   194
    if( iCollectionNames )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   195
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   196
        iCollectionNames->Reset();
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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   199
    // Read shared albums
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   200
    CDesCArray* sharedStuff = new (ELeave) CDesCArrayFlat( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   201
        KDefaultStringArrGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   202
    CleanupStack::PushL( sharedStuff );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   203
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   204
    ReadSharedContainerIDsL( sharedStuff,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   205
                             EImageAndVideo );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   206
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   207
    // fill iCollIdArray
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   208
    SearchCollectionsL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   209
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   210
    // cycle trough albums to collect names to the listbox
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   211
    for (TInt index = 0; index < iCollIdArray->MdcaCount(); index++)
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
        HBufC16* albumName = HBufC16::NewL(KMaxFileName);
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   214
        CleanupStack::PushL( albumName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   215
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   216
        // create item string for listbox (icon + album name)
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   217
        TPtrC16 collectionName = iCollectionNames->MdcaPoint( index );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   218
        albumName->Des().Format( KItemFormatString, &collectionName ); 
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
        // append album name to the listbox
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   221
        aSettingsTextArray->AppendL( albumName->Des() );
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
        // check if album is shared earlier
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   224
        if ( IsItemShared( iCollIdArray->MdcaPoint( index ), *sharedStuff ) )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   225
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   226
            //Index can't be '0' or '1' because there are predefined 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   227
            //selections such as "share nothing" and "share all" first.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   228
            iSelectedImages->AppendL( index + KPredefinedSelections );
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
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
        CleanupStack::PopAndDestroy( albumName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   233
        albumName = NULL;
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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   236
    GetVisualSharingStateL( iVisualSharingSelection );
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
    if ( iVisualSharingSelection == EShareAll )
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
        iSelectedImages->Reset();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   241
        // if all albums were shared mark only "share all"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   242
        iSelectedImages->AppendL( KShareAllIndex );
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
    else if ( iVisualSharingSelection == EShareNone )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   245
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   246
        iSelectedImages->Reset();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   247
        // if no albums were shared mark only "share nothing"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   248
        iSelectedImages->AppendL( KShareNoneIndex );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   249
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   250
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   251
    iContainerCount = aSettingsTextArray->MdcaCount();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   252
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   253
    CleanupStack::PopAndDestroy( sharedStuff );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   254
    __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
   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
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
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   259
// CUpnpSelectionReader::FetchPlaylistsL()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   260
// Fetch playlists from Media Gallery for the listbox.
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
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   263
void CUpnpSelectionReader::FetchPlaylistsL( CDesCArray* aSettingsTextArray )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   264
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   265
    __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
   266
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   267
    if ( !aSettingsTextArray )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   268
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   269
        User::Leave( KErrGeneral );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   270
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   271
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   272
    // This is for IsItemSharedL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   273
    iMediaType = EPlaylist;
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 ( iSelectedMusic )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   276
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   277
        iSelectedMusic->Reset();
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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   280
    if ( iPlIdArray )
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
        iPlIdArray->Reset();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   283
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   284
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( iPlaylistNames )
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
        iPlaylistNames->Reset();
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
    // container where items will be added
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   291
    CDesCArray* sharedStuff = new (ELeave) CDesCArrayFlat( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   292
        KDefaultStringArrGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   293
    CleanupStack::PushL( sharedStuff );
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
    // Read previously shared playlist ids for calculating indexes
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   296
    ReadSharedContainerIDsL( sharedStuff,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   297
                             EPlaylist );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   298
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   299
    // search .m3u files put them to iPlIdArray
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   300
    SearchPlaylistFilesL();
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
    for ( TInt fileIndex = 0; 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   303
          fileIndex < iPlIdArray->MdcaCount(); fileIndex++ )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   304
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   305
        HBufC16* listboxItem = HBufC16::NewL(KMaxFileName);
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   306
        CleanupStack::PushL(listboxItem);
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
        TPtrC itemName( iPlaylistNames->MdcaPoint( fileIndex ) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   309
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   310
        TBuf<KMaxFileName> nameBuf;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   311
        nameBuf.Copy( itemName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   312
        listboxItem->Des().Format(KItemFormatString, &nameBuf );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   313
        aSettingsTextArray->AppendL( listboxItem->Des() );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   314
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   315
        if ( IsItemShared( iPlIdArray->MdcaPoint( fileIndex ),
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   316
                           *sharedStuff ) )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   317
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   318
            //Index can't be '0' or '1' because there are predefined 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   319
            //selections such as "share nothing" and "share all" first.
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   320
            iSelectedMusic->AppendL( fileIndex + KPredefinedSelections );
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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   323
        CleanupStack::PopAndDestroy( listboxItem );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   324
        listboxItem = NULL;
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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   327
    GetMusicSharingStateL( iMusicSharingSelection );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   328
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   329
    if ( iMusicSharingSelection == EShareAll )
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
        iSelectedMusic->Reset();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   332
        // if all albums were shared mark only "share all"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   333
        iSelectedMusic->AppendL( KShareAllIndex );
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
    else if ( iMusicSharingSelection == EShareNone )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   336
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   337
        iSelectedMusic->Reset();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   338
        // if no albums were shared mark only "share nothing"
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   339
        iSelectedMusic->AppendL( KShareNoneIndex );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   340
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   341
    iContainerCount = aSettingsTextArray->MdcaCount();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   342
    CleanupStack::PopAndDestroy( sharedStuff );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   343
    __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
   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
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
// CUpnpSelectionReader::SearchPlaylistFilesL()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   349
// Search playlist files
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   350
// --------------------------------------------------------------------------
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
TBool CUpnpSelectionReader::SearchPlaylistFilesL()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   353
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   354
    __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
   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
    CUPnPPlaylistServices* playlists = CUPnPPlaylistServices::NewL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   357
    CleanupStack::PushL( playlists );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   358
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   359
    playlists->ListPlaylistsL( *iPlIdArray, *iPlaylistNames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   360
    // for debugging
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   361
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   362
#ifdef _DEBUG
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   363
    __LOG("CUpnpSelectionReader: Checking playlist validity.");
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   364
    for ( TInt i(0); i<iPlIdArray->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
   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
        TBool valid(EFalse);
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   367
        TRAPD( err, valid = playlists->IsValidPlaylistL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   368
                   iPlaylistNames->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
   369
        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
   370
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   371
            TPtrC id( iPlIdArray->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
   372
            __LOG3("Playlist[%d] %S IsValid: %d",
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   373
                i, &id, valid );
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
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   376
#endif
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   377
    CleanupStack::PopAndDestroy( playlists );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   378
    __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
   379
    return ETrue;
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
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
// CUpnpSelectionReader::SearchCollectionsL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   384
// fill iCollIdArray
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
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   387
TBool CUpnpSelectionReader::SearchCollectionsL()
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   388
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   389
    __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
   390
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   391
    CUPnPAlbumServices* albums = CUPnPAlbumServices::NewL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   392
    CleanupStack::PushL( albums );
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
    albums->ListAlbumsL( *iCollIdArray, *iCollectionNames );
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
#ifdef _DEBUG
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   397
    __LOG("CUpnpSelectionReader: Checking album validity.");
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   398
    for ( TInt i(0); i<iCollIdArray->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
   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
        TBool valid(EFalse);
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   401
        TRAPD( err, valid = albums->IsValidAlbumL( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   402
                   iCollectionNames->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
   403
        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
   404
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   405
            TPtrC id( iCollIdArray->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
   406
            __LOG3("Album[%d] %S IsValid: %d",
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   407
                i, &id, valid );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   408
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   409
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   410
#endif
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   411
    CleanupStack::PopAndDestroy( albums );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   412
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   413
    __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
   414
    return ETrue;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   415
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   416
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
// CUPnPFileSharingEngine::ReadSharedContainerIDsL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   419
// Reads shared container IDs from file
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
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   422
TInt CUpnpSelectionReader::ReadSharedContainerIDsL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   423
    CDesCArray* aArray,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   424
    const TUpnpMediaType& aContainerType ) const
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
    __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
   427
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   428
    // Leave if NULL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   429
    if ( !aArray )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   430
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   431
        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
   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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   434
    RFs fs;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   435
    RFile file;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   436
    User::LeaveIfError( fs.Connect() );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   437
    CleanupClosePushL(fs);
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
    TInt error = 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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   441
    if ( aContainerType == EImageAndVideo )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   442
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   443
        error = file.Open(fs, KVisualFile, EFileRead );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   444
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   445
    else if ( aContainerType == EPlaylist )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   446
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   447
        error = file.Open(fs, KMusicFile, EFileRead );
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
    else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   450
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   451
        // Not valid container type
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   452
        error = KErrNotFound;
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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   455
    if ( error == KErrNone )
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
        CleanupClosePushL( file );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   458
        RFileReadStream readStream( file );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   459
        CleanupClosePushL( readStream );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   460
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   461
        HBufC* collectionName = HBufC::NewL(KMaxFileName);
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   462
        CleanupStack::PushL( collectionName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   463
        TPtr collection = collectionName->Des();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   464
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   465
        do
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   466
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   467
            TRAPD(err, readStream >> collection); //leaves when eof
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   468
            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
   469
                {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   470
                error = err;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   471
                }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   472
            else
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
                aArray->AppendL(collection);
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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   477
            }  while(error == KErrNone); // end of file
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   478
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   479
        CleanupStack::PopAndDestroy( collectionName );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   480
        CleanupStack::PopAndDestroy( &readStream ); // Close readStream
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   481
        CleanupStack::PopAndDestroy( &file ); // Close file
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   482
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   483
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   484
     CleanupStack::PopAndDestroy( &fs );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   485
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   486
    __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
   487
    return error;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   488
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   489
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   490
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
// CUPnPFileSharingEngine::GetSelectionIndexesL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   493
// Reads shared container IDs from file
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   494
// --------------------------------------------------------------------------
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
void CUpnpSelectionReader::GetSelectionIndexesL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   497
    RArray<TInt>& aSelections,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   498
    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
   499
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   500
    __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
   501
    RArray<TInt>* list( NULL );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   502
    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
   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
        if ( !iSelectedImages )
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
            iImageContainers->Reset();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   507
            FetchCollectionsL( iImageContainers );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   508
            iImageContainers->Reset();
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
        else if ( !iImageContainers )
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
            iImageContainers = new (ELeave) CDesCArrayFlat( 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   513
                KDefaultStringArrGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   514
            FetchCollectionsL( iImageContainers );
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
        else 
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
            FetchCollectionsL( iImageContainers );
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
            
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   521
        list = iSelectedImages;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   522
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   523
    else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   524
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   525
        if ( !iSelectedMusic )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   526
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   527
            iPlaylistNames->Reset();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   528
            FetchPlaylistsL( iPlaylistNames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   529
            iPlaylistNames->Reset();
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
        else if ( iPlaylistNames )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   532
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   533
            iPlaylistNames = new (ELeave) 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   534
                CDesCArrayFlat( KDefaultStringArrGranularity );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   535
            FetchPlaylistsL( iPlaylistNames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   536
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   537
        else 
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
            FetchPlaylistsL( iPlaylistNames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   540
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   541
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   542
        list = iSelectedMusic;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   543
        }
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
    for ( TInt i(0); i< list->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
   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
        aSelections.AppendL( list->operator[]( i ) );
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
    __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
   550
    }
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
// CUpnpSelectionReader::GetVisualSharingStateL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   554
// (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
   555
// --------------------------------------------------------------------------
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
TInt CUpnpSelectionReader::GetVisualSharingStateL( TInt& aShareAllState )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   558
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   559
    __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
   560
    CRepository* rep = CRepository::NewL( KCrUidUpnpContentserver );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   561
    CleanupStack::PushL( rep );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   562
    TInt err( rep->Get( KUPnPAppShareAllVisualFiles, aShareAllState ));
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   563
    CleanupStack::PopAndDestroy( rep );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   564
    __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
   565
    return err;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   566
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   567
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
// CUpnpSelectionReader::GetMusicSharingStateL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   570
// (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
   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
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   573
TInt CUpnpSelectionReader::GetMusicSharingStateL( TInt& aShareAllState )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   574
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   575
    __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
   576
    CRepository* rep = CRepository::NewL( KCrUidUpnpContentserver );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   577
    CleanupStack::PushL( rep );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   578
    TInt err( rep->Get( KUPnPAppShareAllMusicFiles, aShareAllState ));
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   579
    CleanupStack::PopAndDestroy( rep );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   580
    __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
   581
    return err;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   582
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   583
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
// CUpnpSelectionReader::GetContainerCount
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   586
// (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
   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
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   589
TInt CUpnpSelectionReader::GetContainerCount() const
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
    __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
   592
    __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
   593
    return iContainerCount;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   594
    }
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
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   597
// CUpnpSelectionReader::PlayListIdsL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   598
// (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
   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
TInt CUpnpSelectionReader::PlayListIdsL( CDesCArray& aPlaylistIds, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   602
                                        CDesCArray& aPlaylistNames )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   603
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   604
    __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
   605
    TInt 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
   606
    if ( iPlIdArray && iPlaylistNames )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   607
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   608
        for ( TInt i(0); i < iPlIdArray->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
   609
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   610
            aPlaylistIds.AppendL( iPlIdArray->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
   611
            aPlaylistNames.AppendL( iPlaylistNames->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
   612
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   613
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   614
    else
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
        err = KErrGeneral;
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
    return err;
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
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   624
// CUpnpSelectionReader::CollectionIdsL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   625
// (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
   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
//
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   628
TInt CUpnpSelectionReader::CollectionIdsL( CDesCArray& aCollectionIds,
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   629
                                             CDesCArray& aCollectionNames )
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
    __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
   632
    TInt 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
   633
    if ( iCollIdArray && iCollectionNames )
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
        for ( TInt i(0); i < iCollIdArray->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
   636
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   637
            aCollectionIds.AppendL( iCollIdArray->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
   638
            aCollectionNames.AppendL( iCollectionNames->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
   639
            }
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
    else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   642
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   643
        err = KErrGeneral;
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
    
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   646
    __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
   647
    return err;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   648
    }
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
// CUpnpSelectionReader::GetCollectionItemsL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   652
// (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
   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
TPtrC CUpnpSelectionReader::GetCollectionItemsL( const TInt aSelectionIndex, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   656
    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
   657
    {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   658
    __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
   659
    TPtrC collId;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   660
    TInt index = aSelectionIndex - KUiSelectionOffset;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   661
    if ( index < 0 || index >= iCollIdArray->Count() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   662
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   663
        // index is not valid
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   664
        collId.Set( KNullDesC );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   665
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   666
    else
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
        // Find out collection id
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   669
        collId.Set( iCollIdArray->MdcaPoint( index ) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   670
        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   671
        // Fetch collection items
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   672
        CUPnPAlbumServices* albums = CUPnPAlbumServices::NewL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   673
        CleanupStack::PushL( albums );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   674
        albums->OpenAlbumL( collId, aFilenames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   675
        TInt count = aFilenames.Count();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   676
        CleanupStack::PopAndDestroy( albums );        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   677
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   678
    __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
   679
    return collId;
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
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   682
// --------------------------------------------------------------------------
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   683
// CUpnpSelectionReader::GetPlaylistItemsL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   684
// (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
   685
// --------------------------------------------------------------------------
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
TPtrC CUpnpSelectionReader::GetPlaylistItemsL( const TInt aSelectionIndex, 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   688
    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
   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
    __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
   691
    TPtrC plId;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   692
    TInt index = aSelectionIndex - KUiSelectionOffset;    
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 ( index < 0 || index >= iPlIdArray->Count() )    
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
        // index is not valid
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   696
        plId.Set( KNullDesC );
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
        // Find out playlist id
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   701
        plId.Set( iPlIdArray->MdcaPoint( index ) );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   702
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   703
        // Fetch playlist items
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   704
        CUPnPPlaylistServices* playlists = CUPnPPlaylistServices::NewL();
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   705
        CleanupStack::PushL( playlists );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   706
        playlists->OpenPlaylistL( iPlIdArray->MdcaPoint( index ), aFilenames );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   707
        CleanupStack::PopAndDestroy( playlists );        
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   708
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   709
    __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
   710
    return plId;
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
// CUPnPFileSharingEngine::GetSelectionIndexesL
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   715
// Reads shared container IDs from file
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
TInt CUpnpSelectionReader::GetSelectionIndexL(
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   719
    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
   720
    TPtrC aClfId )
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
    __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
   723
    TInt selectionIndex( KErrNotFound );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   724
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   725
    // image and video
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   726
    if ( aType == EImageAndVideo && iCollIdArray->Count() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   727
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   728
        iCollIdArray->Find( aClfId, selectionIndex );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   729
        if ( selectionIndex >= iCollIdArray->Count() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   730
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   731
            // not found in iCollIdArray
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   732
            selectionIndex = KErrNotFound;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   733
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   734
        else
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   735
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   736
            selectionIndex = 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   737
                selectionIndex + KUiSelectionOffset;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   738
            }
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
    // music
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   741
    else if ( aType == EPlaylist && iPlIdArray->Count() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   742
        {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   743
        iPlIdArray->Find( aClfId, selectionIndex );
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   744
        if ( selectionIndex >= iPlIdArray->Count() )
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   745
            {
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   746
            // not found in iPlIdArray
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   747
            selectionIndex = KErrNotFound;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   748
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   749
        else
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
            selectionIndex = 
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   752
                selectionIndex + KUiSelectionOffset;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   753
            }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   754
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   755
    else
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
        // invalid type or the array is empty
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   758
        selectionIndex = KErrNotFound;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   759
        }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   760
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   761
    __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
   762
    // return selection index taking into count Ui offset
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   763
    return selectionIndex;
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   764
    }
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   765
5360b7ddc251 New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents: 32
diff changeset
   766
// End of file