serviceproviders/sapi_applicationmanager/src/appmanagerinterface.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 24 Nov 2009 08:56:33 +0200
changeset 23 50974a8b132e
parent 5 989d2f495d90
child 46 5146369cfdc9
permissions -rw-r--r--
Revision: 200945 Kit: 200948
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     1
/*
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     8
*
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    11
*
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    12
* Contributors:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    13
*
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    14
* Description:  This Class provides the interface for
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    15
*				 calling the functionality to Application Manager SAPI.
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    16
*  Interafce
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    17
*
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    18
*/
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    19
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    20
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    21
23
50974a8b132e Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
    22
#include <liwcommon.h>
50974a8b132e Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
    23
#include <liwbufferextension.h>
5
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    24
#include <utf.h>
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    25
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    26
#include "appmanagerinterface.h"
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    27
#include "appmanagerservice.h"
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    28
#include "appitemslist.h"
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    29
#include "appserviceobserver.h"
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    30
#include "serviceerrno.h"
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    31
#include "appserviceerrmsg.hrh"
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    32
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    33
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    34
#define KMAXCONTENTLENGTH 32
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    35
#define KMAXPATHLENGTH 255
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    36
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    37
//Supported Operation
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    38
_LIT8(KGetList,  "GetList");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    39
_LIT8(KCancel,  "Cancel");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    40
_LIT8(KLaunchApp,"LaunchApp");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    41
_LIT8(KLaunchDoc,"LaunchDoc");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    42
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    43
//Input Keys/arguments
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    44
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    45
// Data source name
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    46
_LIT8(KType,"Type");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    47
_LIT8(KApplicationID,"ApplicationID");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    48
_LIT8(KCmdLine,"CmdLine");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    49
_LIT8(KOptions,"Options");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    50
_LIT8(KDocument,"Document");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    51
_LIT8(KMimeType,"MimeType");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    52
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    53
// Filter Map
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    54
_LIT8(KFilter,"Filter");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    55
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    56
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    57
//Filter criteria
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    58
_LIT8(KDocumentPath,"DocumentPath");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    59
_LIT8(KMode,"Mode");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    60
_LIT8(KPosition,"Position");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    61
//_LIT8(KPath ,"Path");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    62
_LIT8(KHandle,"Handle");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    63
_LIT8(KDocumentName,"DocumentName");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    64
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    65
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    66
//Possible Content
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    67
//_LIT(KUserInstalledPackage,"UserInstalledPackage");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    68
//_LIT(KApplication,"Application");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    69
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    70
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    71
//Output Keys/arguments
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    72
_LIT8(KResponse,"ReturnValue");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    73
_LIT8(KErrorCode,"ErrorCode");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    74
_LIT8(KTransactionID,"TransactionID");
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    75
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    76
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    77
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    78
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    79
// CAppManagerInterface::NewLC
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    80
// Returns the instance of CAppManagerInterface.
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    81
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    82
CAppManagerInterface* CAppManagerInterface::NewL()
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    83
	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    84
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    85
	CAppManagerInterface* self = new ( ELeave )CAppManagerInterface();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    86
	CleanupStack::PushL( self );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    87
	self->ConstructL();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    88
	CleanupStack::Pop( self );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    89
	return self;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    90
	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    91
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    92
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    93
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    94
// CAppManagerInterface::~CAppManagerInterface
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    95
// Destructor of class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    96
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    97
CAppManagerInterface::~CAppManagerInterface()
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    98
	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    99
     //Release the instance of core class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   100
	 delete iCoreClass;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   101
     iCoreClass = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   102
	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   103
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   104
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   105
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   106
// CAppManagerService::ExecuteCmdL
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   107
// Request handler method of interface class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   108
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   109
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   110
void CAppManagerInterface::ExecuteCmdL(const TDesC8& aCmdName,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   111
                           const CLiwGenericParamList& aInParamList,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   112
                           CLiwGenericParamList& aOutParamList,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   113
                           TUint aCmdOptions ,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   114
                           MLiwNotifyCallback* aCallBack)
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   115
	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   116
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   117
    TInt32 transactionID = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   118
	TInt errCode = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   119
	TInt pos = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   120
    const TLiwGenericParam* param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   121
    TLiwGenericParam posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   122
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   123
    if( (aCmdOptions & KLiwOptCancel ) && (0== aCmdName.CompareF( KCancel ))) // for cancel asynchronous request
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   124
	    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   125
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   126
            param = aInParamList.FindFirst( pos, KTransactionID );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   127
            if( !param )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   128
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   129
                
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   130
                if( aInParamList.Count() > 0 )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   131
                    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   132
                     pos = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   133
                     aInParamList.AtL( pos, posbasedparam );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   134
                     if (posbasedparam.Value().IsEmpty() )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   135
                        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   136
                        param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   137
                        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   138
                     else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   139
                        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   140
                        param = &posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   141
                        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   142
                     }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   143
               
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   144
                 }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   145
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   146
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   147
            if( param )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   148
			    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   149
			    param->Value().Get( transactionID );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   150
                errCode = iCoreClass->Cancel( transactionID );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   151
		    	if ( KErrNone != errCode )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   152
			        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   153
			        TInt sapiErr = SapiError(errCode);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   154
                    aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)sapiErr)));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   155
                    aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KIncorrectTransactionId ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   156
			        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   157
			    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   158
			else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   159
			    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   160
			    aOutParamList.AppendL( TLiwGenericParam ( KErrorCode,TLiwVariant( TInt32( SErrMissingArgument ) ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   161
			    aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KTransactionIdMissing ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   162
	            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   163
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   164
	    return;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   165
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   166
    	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   167
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   168
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   169
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   170
    // Check the command name;Cmd name should be GetList,LaunchApp or LaunchDoc
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   171
	if( 0 == aCmdName.CompareF( KGetList ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   172
		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   173
	    //Call GetListAPI
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   174
	    if( (aCmdOptions & KLiwOptASyncronous ) && ( NULL != aCallBack ) ) //Asynchronous request
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   175
		    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   176
		    //No Asynch version of getlist is supported
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   177
             aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrNotSupported))));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   178
             aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant(KAsynchVersionNotSupported ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   179
		    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   180
		else if( (!aCmdOptions) && ( NULL == aCallBack ) ) //Synchronous request
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   181
		    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   182
		    GetListL( aInParamList, aOutParamList );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   183
		    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   184
		else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   185
		    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   186
		    aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrArgument))));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   187
		    aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KAsynchRequestNotProper ) )  );    
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   188
		    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   189
	    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   190
	else if( 0 == aCmdName.CompareF( KLaunchApp ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   191
	    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   192
	    //Call LaunchApp API
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   193
	    if( (aCmdOptions & KLiwOptASyncronous ) && ( NULL != aCallBack ) ) //Asynchronous request
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   194
	        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   195
	            
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   196
	        //Asynch Call
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   197
	        transactionID = aCallBack->GetTransactionID();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   198
	        LaunchAppL( aInParamList, aOutParamList, aCallBack , transactionID );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   199
	            	            
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   200
	        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   201
	    else if( (!aCmdOptions) && ( NULL == aCallBack ) ) //Synchronous request
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   202
	        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   203
	        //Synchronous Call
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   204
	        LaunchAppL( aInParamList, aOutParamList);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   205
	        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   206
	    else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   207
	        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   208
	        aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrArgument))));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   209
		    aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KAsynchRequestNotProper ) )  );       
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   210
	        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   211
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   212
	    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   213
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   214
	else if( 0 == aCmdName.CompareF( KLaunchDoc )  )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   215
	    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   216
	    //Call LaunchDoc API
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   217
	    if( (aCmdOptions & KLiwOptASyncronous ) && ( NULL != aCallBack ) ) //Asynchronous request
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   218
	        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   219
	         //Asynch Call
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   220
	         transactionID = aCallBack->GetTransactionID();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   221
	         LaunchDocL( aInParamList, aOutParamList, aCallBack , transactionID );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   222
	        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   223
	        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   224
	    else if( (!aCmdOptions) && ( NULL == aCallBack ) ) //Synchronous request
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   225
	        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   226
	        //Synchronous Call
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   227
	        LaunchDocL( aInParamList, aOutParamList);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   228
	        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   229
	    else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   230
	        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   231
	        aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrArgument))));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   232
		    aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KAsynchRequestNotProper ) )  );       
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   233
	        }    
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   234
	    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   235
	else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   236
	    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   237
	    //error code = command not supported
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   238
	    aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrNotSupported))));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   239
	    aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KCommandNotSupported ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   240
	    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   241
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   242
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   243
    if( (aCmdOptions & KLiwOptASyncronous ) && ( NULL != aCallBack ) ) //Asynchronous request
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   244
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   245
		aOutParamList.AppendL( TLiwGenericParam( KTransactionID, TLiwVariant( transactionID ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   246
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   247
	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   248
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   249
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   250
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   251
// CAppManagerInterface::CAppManagerInterface
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   252
// Constructor  of class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   253
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   254
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   255
CAppManagerInterface::CAppManagerInterface()
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   256
                       :iCoreClass( NULL )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   257
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   258
	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   259
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   260
	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   261
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   262
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   263
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   264
// CAppManagerInterface::ConstructL
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   265
// Two-phased constructor of class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   266
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   267
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   268
void CAppManagerInterface::ConstructL()
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   269
	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   270
	// Create the instance of core class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   271
	iCoreClass = CAppManagerService::NewL();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   272
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   273
    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   274
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   275
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   276
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   277
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   278
// CAppManagerInterface::GetListL
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   279
// This function will send the request to Core class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   280
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   281
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   282
void CAppManagerInterface::GetListL(const CLiwGenericParamList& aInParamList , CLiwGenericParamList& aOutParamList  )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   283
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   284
	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   285
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   286
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   287
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   288
	 TLiwGenericParam posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   289
     TBool postionbasedsearching = EFalse;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   290
	 const TLiwGenericParam* param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   291
	 TInt pos = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   292
	 param = aInParamList.FindFirst( pos, KType );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   293
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   294
	 if(!param)
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   295
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   296
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   297
         if( aInParamList.Count() > 0 )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   298
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   299
            pos = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   300
            aInParamList.AtL( pos,posbasedparam );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   301
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   302
            if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   303
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   304
                param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   305
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   306
            else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   307
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   308
                param = &posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   309
                postionbasedsearching = ETrue;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   310
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   311
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   312
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   313
    TBuf<KMAXCONTENTLENGTH>  content;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   314
    if( param )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   315
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   316
        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   317
	 // content present : Mandatory Argument
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   318
		if (param->Value().TypeId() != LIW::EVariantTypeDesC || param->Value().AsDes().Length() > KMAXCONTENTLENGTH || !param->Value().Get( content )   ) 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   319
	    	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   320
	    	//content type is different: append error and return
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   321
	    	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ((TInt32)SErrBadArgumentType) ));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   322
	    	aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KContentTypeMismatch ) ) ); 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   323
	    	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   324
	    	posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   325
	    	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   326
	    	return;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   327
	    	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   328
	  
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   329
        HBufC8* heapBuffer = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   330
     	param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   331
       	if ( postionbasedsearching && ( aInParamList.Count() > 1) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   332
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   333
            pos = 1;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   334
            aInParamList.AtL( pos,posbasedparam );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   335
            if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   336
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   337
                param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   338
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   339
            else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   340
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   341
                param = &posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   342
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   343
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   344
        else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   345
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   346
            pos=0;//Search from starting point
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   347
            //filter map
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   348
            param =  aInParamList.FindFirst( pos, KFilter );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   349
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   350
        CFilterParam* filter = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   351
        TLiwVariant documentname;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   352
	    TLiwVariant mimetype;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   353
	    
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   354
	    
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   355
        //Filter is prsent
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   356
        if ( param && (param->Value().TypeId() != LIW::EVariantTypeNull ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   357
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   358
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   359
            filter = CFilterParam::NewL();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   360
            CleanupStack::PushL( filter );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   361
            const CLiwMap* filtermap;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   362
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   363
	        TPtrC val;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   364
	        filtermap = param->Value().AsMap();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   365
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   366
			if (filtermap )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   367
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   368
                CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &documentname) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   369
	    
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   370
                if (filtermap->FindL( KDocumentPath, documentname ) && (documentname.TypeId() != LIW::EVariantTypeNull )  )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   371
                	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   372
                	if ((documentname.AsDes().Length() < KMAXPATHLENGTH ) && documentname.Get(val))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   373
                		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   374
                		filter->SetDocName(val);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   375
                		val.Set(NULL,0);	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   376
                		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   377
                	 else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   378
                	 	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   379
                	 	//content type is different: do cleanup, append error and return			        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   380
				        CleanupStack::Pop(&documentname);    
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   381
				        documentname.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   382
				        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   383
                	 	if( filter )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   384
				            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   385
				            CleanupStack::PopAndDestroy( filter );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   386
				            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   387
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   388
                	 	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   389
                		aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KFilterTypeMismatch ) ) ); 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   390
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   391
                		posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   392
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   393
                		return;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   394
                	 	}	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   395
                	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   396
                	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   397
				CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &mimetype) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   398
	            if (filtermap->FindL( KMimeType, mimetype ) && (mimetype.TypeId() != LIW::EVariantTypeNull ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   399
	            	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   400
	            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   401
	                if ((mimetype.AsDes().Length() < KMAXPATHLENGTH ) && mimetype.Get(val))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   402
                		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   403
	               		//Before sending convert 16 bit to 8 Bit
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   404
			            heapBuffer = HBufC8::NewL(val.Length());
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   405
		                TPtr8  val8(heapBuffer->Des());
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   406
		                val8.Copy(val);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   407
		                filter->SetmimeType(val8);			
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   408
	            		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   409
	            	else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   410
                	 	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   411
                	 	//content type is different: do cleanup, append error and return
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   412
                	 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   413
                	 	CleanupStack::Pop(&mimetype); 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   414
				        mimetype.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   415
				        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   416
				        CleanupStack::Pop(&documentname);    
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   417
				        documentname.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   418
				        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   419
                	 	if( filter )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   420
				            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   421
				            CleanupStack::PopAndDestroy( filter );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   422
				            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   423
   
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   424
				        delete heapBuffer;    
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   425
				         
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   426
                	 	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   427
                		aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KFilterTypeMismatch ) ) ); 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   428
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   429
                		posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   430
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   431
                		return;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   432
                	 	}			            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   433
	            	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   434
	            CleanupStack::Pop(2);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   435
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   436
	        else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   437
	            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   438
	            aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType  ) ));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   439
                aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KFilterTypeMismatch ) ) ); 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   440
                CleanupStack::PopAndDestroy( filter );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   441
                posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   442
                return;   
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   443
	            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   444
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   445
	        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   446
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   447
         //Call GetList of Core class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   448
         MIterator* iter = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   449
         TRAPD ( errCode, iCoreClass->GetListL( iter, content, filter ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   450
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   451
         TInt sapiErr = SErrNone;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   452
         if (errCode)
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   453
    	    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   454
    	    sapiErr = SapiError(errCode);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   455
    	    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   456
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   457
         aOutParamList.AppendL( TLiwGenericParam ( KErrorCode,TLiwVariant( ( TInt32 )sapiErr ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   458
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   459
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   460
         if( errCode == KErrNone )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   461
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   462
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   463
             // Fill the Iterator in Generic Paaram List
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   464
             TLiwVariant response;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   465
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   466
	         // Iterator will accept the MIterator * and will become the owner
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   467
             CAppItemsList *iterator = CAppItemsList::NewL( iter );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   468
 	         CleanupClosePushL( *iterator );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   469
	         response.Set( iterator );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   470
	         aOutParamList.AppendL( TLiwGenericParam ( KResponse, response ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   471
 		     CleanupStack::Pop( iterator );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   472
             iterator->DecRef();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   473
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   474
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   475
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   476
          if( filter )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   477
            {		        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   478
            CleanupStack::PopAndDestroy( filter );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   479
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   480
            
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   481
          mimetype.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   482
		  documentname.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   483
       	  
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   484
       	  delete heapBuffer;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   485
       	 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   486
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   487
     else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   488
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   489
        //content type missig : Mandatory Argument
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   490
        aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrMissingArgument)));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   491
        aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KContentMissing ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   492
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   493
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   494
       posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   495
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   496
	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   497
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   498
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   499
// CAppManagerInterface::LaunchAppL
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   500
// This function will send the request to Core class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   501
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   502
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   503
void CAppManagerInterface::LaunchAppL(const CLiwGenericParamList& aInParamList ,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   504
                                            CLiwGenericParamList& aOutParamList,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   505
                                            MLiwNotifyCallback* aCallBack,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   506
                                            TInt32 aTransactionID )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   507
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   508
	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   509
	 TLiwGenericParam posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   510
     TBool postionbasedsearching = EFalse;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   511
     TOptions options;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   512
	 const TLiwGenericParam* param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   513
	 TInt pos = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   514
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   515
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   516
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   517
	 param = aInParamList.FindFirst( pos, KApplicationID );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   518
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   519
	 if( !param )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   520
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   521
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   522
         if( aInParamList.Count() > 0 )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   523
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   524
            pos = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   525
            aInParamList.AtL( pos,posbasedparam );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   526
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   527
             if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   528
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   529
                param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   530
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   531
            else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   532
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   533
                param = &posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   534
                postionbasedsearching = ETrue;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   535
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   536
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   537
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   538
    TBuf<KMAXCONTENTLENGTH> appId;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   539
    if( param )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   540
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   541
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   542
        // content present : Mandatory Argument
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   543
		if (param->Value().TypeId() != LIW::EVariantTypeDesC || param->Value().AsDes().Length() > KMAXCONTENTLENGTH || !param->Value().Get( appId ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   544
	    	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   545
	    	//content type is different: append error and return
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   546
	    	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ((TInt32)SErrBadArgumentType) ));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   547
	    	aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KApplicationIDMismatch ) ) ); 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   548
	    	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   549
	    	posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   550
	    	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   551
	    	return;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   552
	    	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   553
	    	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   554
        TPtrC  cmdline;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   555
       // TBuf<KMAXCONTENTLENGTH> cmdline;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   556
        TLiwVariant mode;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   557
	    TLiwVariant postion;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   558
	    TLiwVariant document;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   559
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   560
       	param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   561
        if ( postionbasedsearching && ( aInParamList.Count() > 1) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   562
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   563
            pos = 1;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   564
            aInParamList.AtL( pos,posbasedparam );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   565
           if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   566
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   567
                param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   568
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   569
            else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   570
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   571
                param = &posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   572
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   573
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   574
        else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   575
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   576
            pos=0;//Search from starting point
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   577
            //filter map
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   578
            param =  aInParamList.FindFirst( pos, KCmdLine );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   579
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   580
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   581
        //CommandLine  is prsent
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   582
        if ( param && (param->Value().TypeId() != LIW::EVariantTypeNull ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   583
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   584
            if( !param->Value().Get( cmdline ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   585
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   586
                aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   587
                aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KCommandLineMismatch ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   588
                posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   589
                return;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   590
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   591
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   592
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   593
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   594
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   595
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   596
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   597
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   598
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   599
        param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   600
       	if ( postionbasedsearching && ( aInParamList.Count() > 2) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   601
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   602
            pos = 2;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   603
            aInParamList.AtL( pos,posbasedparam );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   604
            if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   605
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   606
                param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   607
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   608
            else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   609
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   610
                param = &posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   611
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   612
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   613
        else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   614
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   615
            pos=0;//Search from starting point
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   616
            //filter map
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   617
            param =  aInParamList.FindFirst( pos, KOptions );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   618
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   619
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   620
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   621
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   622
		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   623
        //Options is prsent
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   624
        if ( param && (param->Value().TypeId() != LIW::EVariantTypeNull ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   625
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   626
            if( (param->Value().TypeId() != LIW::EVariantTypeMap ) && 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   627
            	(param->Value().TypeId() != LIW::EVariantTypeNull ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   628
            		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   629
            		aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   630
                	aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   631
	                posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   632
	                return;    	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   633
            		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   634
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   635
            const CLiwMap* optionsmap = param->Value().AsMap();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   636
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   637
            if ( optionsmap )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   638
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   639
				CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &mode) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   640
				
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   641
                if (optionsmap->FindL( KMode, mode ) && (mode.TypeId() != LIW::EVariantTypeNull ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   642
                	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   643
                	if (( mode.AsDes().Length() > KMAXCONTENTLENGTH ) || !mode.Get( options.iMode ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   644
                		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   645
	               	 	//content type is different: do cleanup, append error and return 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   646
				         
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   647
				        CleanupStack::Pop(&mode);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   648
				        mode.Reset() ;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   649
				         
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   650
                	 	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   651
                		aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   652
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   653
                		posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   654
                		return;		            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   655
	            		}	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   656
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   657
                	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   658
	            
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   659
	            CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &postion) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   660
				
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   661
                if (optionsmap->FindL( KPosition, postion ) && (postion.TypeId() != LIW::EVariantTypeNull ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   662
                	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   663
                	if (( postion.AsDes().Length() > KMAXCONTENTLENGTH ) || !postion.Get( options.iPostion ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   664
                		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   665
	               	 	//content type is different: do cleanup, append error and return 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   666
	               	 	CleanupStack::Pop(&postion);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   667
	               	 	CleanupStack::Pop(&mode);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   668
	               	 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   669
				        mode.Reset() ;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   670
				        postion.Reset() ;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   671
				         
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   672
                	 	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   673
                		aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   674
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   675
                		posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   676
                		return;		            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   677
	            		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   678
                	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   679
	            
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   680
	            CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &document) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   681
	            
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   682
				if (optionsmap->FindL( KDocumentPath, document ) || (document.TypeId() != LIW::EVariantTypeNull ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   683
					{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   684
					if ( ( document.AsDes().Length() > KMAXPATHLENGTH ) || !document.Get( options.iDocument ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   685
						{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   686
	               	 	//content type is different: do cleanup, append error and return 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   687
	               	 	CleanupStack::Pop(3); //document, position, mode
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   688
	               	 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   689
				        mode.Reset() ;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   690
				        postion.Reset() ;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   691
				        document.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   692
				         
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   693
                	 	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   694
                		aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   695
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   696
                		posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   697
                		return;		            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   698
	            		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   699
					} 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   700
				
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   701
				CleanupStack::Pop(3);	 //document, position, mode
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   702
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   703
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   704
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   705
	        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   706
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   707
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   708
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   709
       TInt errCode;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   710
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   711
       //Converting command line form 16 to 8-bit
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   712
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   713
       HBufC8* heapBuffer = HBufC8::NewL( cmdline.Length() );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   714
       CleanupStack::PushL( heapBuffer );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   715
       TPtr8 cmdline8( heapBuffer->Des() );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   716
       cmdline8.Copy( cmdline );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   717
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   718
        if( aCallBack )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   719
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   720
             //Asynch Call
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   721
             CAppServiceObserver* observer = CAppServiceObserver::NewL( aCallBack );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   722
             CleanupStack::PushL( observer );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   723
             TRAP ( errCode, iCoreClass->LaunchApplicationL( appId, cmdline8, options, observer,  aTransactionID  )  );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   724
             CleanupStack::Pop( observer );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   725
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   726
        else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   727
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   728
             TRAP ( errCode, iCoreClass->LaunchApplicationL( appId, cmdline8, options )  );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   729
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   730
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   731
        CleanupStack::PopAndDestroy( heapBuffer );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   732
                
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   733
        mode.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   734
	    postion.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   735
	    document.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   736
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   737
        TInt sapiErr = SErrNone;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   738
        if (errCode)
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   739
           {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   740
           sapiErr = SapiError( errCode );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   741
           }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   742
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   743
        aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( ( TInt32 ) sapiErr ) ));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   744
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   745
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   746
     else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   747
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   748
        //content type missig : Mandatory Argument
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   749
        aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrMissingArgument) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   750
        aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KApplicationIDMissing ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   751
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   752
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   753
       posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   754
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   755
	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   756
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   757
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   758
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   759
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   760
// CAppManagerInterface::GetListL
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   761
// This function will send the request to Core class
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   762
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   763
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   764
void CAppManagerInterface::LaunchDocL(const CLiwGenericParamList& aInParamList,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   765
                                            CLiwGenericParamList& aOutParamList,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   766
                                            MLiwNotifyCallback* aCallBack,
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   767
                                            TInt32 aTransactionID )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   768
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   769
	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   770
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   771
	 TLiwGenericParam posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   772
     TBool postionbasedsearching = EFalse;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   773
     TDocument document;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   774
     TOptions options;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   775
	 const TLiwGenericParam* param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   776
	 TInt pos = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   777
	 const CLiwMap* documentmap = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   778
     TLiwVariant mode;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   779
     TLiwVariant path;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   780
	 TLiwVariant handle;   
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   781
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   782
	 param = aInParamList.FindFirst( pos, KDocument );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   783
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   784
	 if( !param )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   785
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   786
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   787
         if( aInParamList.Count() > 0 )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   788
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   789
            pos = 0;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   790
            aInParamList.AtL( pos,posbasedparam );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   791
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   792
            if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   793
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   794
                param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   795
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   796
            else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   797
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   798
                param = &posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   799
                postionbasedsearching = ETrue;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   800
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   801
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   802
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   803
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   804
    if ( param )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   805
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   806
          documentmap = param->Value().AsMap();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   807
	      if ((param->Value().TypeId() != LIW::EVariantTypeNull) && 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   808
	      		(!documentmap && !postionbasedsearching))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   809
	        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   810
	        aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   811
	        aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchDocMapTypeMismatch ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   812
	        posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   813
	        return;    
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   814
	        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   815
            
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   816
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   817
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   818
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   819
    param = aInParamList.FindFirst( pos, KMimeType );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   820
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   821
    if( !param )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   822
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   823
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   824
         if( aInParamList.Count() > 1 )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   825
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   826
            pos = 1;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   827
            aInParamList.AtL( pos,posbasedparam );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   828
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   829
            if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   830
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   831
                param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   832
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   833
            else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   834
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   835
                param = &posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   836
                postionbasedsearching = ETrue;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   837
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   838
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   839
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   840
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   841
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   842
	if ((param) && (param->Value().TypeId() != LIW::EVariantTypeNull)  && (param->Value().TypeId() != LIW::EVariantTypeDesC)  )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   843
		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   844
		aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   845
        aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchDocMimeTypeMismatch ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   846
        posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   847
        return;    	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   848
		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   849
		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   850
		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   851
    // present : Mandatory Argument
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   852
    TBuf<KMAXCONTENTLENGTH>  mimetype;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   853
    if( ( (param)  && ( param->Value().AsDes().Length() < KMAXCONTENTLENGTH ) && (param->Value().Get( mimetype ))  ) || ( documentmap ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   854
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   855
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   856
        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   857
        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   858
        param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   859
       	if ( postionbasedsearching && ( aInParamList.Count() > 2) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   860
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   861
            pos = 2;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   862
            aInParamList.AtL( pos,posbasedparam );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   863
            if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   864
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   865
                param = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   866
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   867
            else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   868
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   869
                param = &posbasedparam;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   870
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   871
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   872
        else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   873
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   874
            pos=0;//Search from starting point
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   875
            //filter map
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   876
            param =  aInParamList.FindFirst( pos, KOptions );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   877
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   878
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   879
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   880
        //Options is prsent
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   881
        if ( param )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   882
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   883
            if( (param->Value().TypeId() != LIW::EVariantTypeMap ) && 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   884
            	(param->Value().TypeId() != LIW::EVariantTypeNull ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   885
        		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   886
        		 //Option Type MisMatch 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   887
            
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   888
                mode.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   889
                
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   890
                aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType  ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   891
                aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchOptionsTypeMismatch ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   892
                posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   893
                return;       	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   894
        		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   895
            		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   896
            const CLiwMap* optionsmap = param->Value().AsMap();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   897
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   898
            if(optionsmap)
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   899
            	 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   900
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   901
                CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &mode) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   902
                optionsmap->FindL( KMode, mode );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   903
                if (( mode.AsDes().Length() > KMAXCONTENTLENGTH ) || !mode.Get( options.iMode ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   904
                		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   905
	               	      
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   906
				        CleanupStack::Pop(&mode);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   907
				        mode.Reset() ;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   908
				         
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   909
                	 	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   910
                		aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   911
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   912
                		posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   913
                		return;		            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   914
	            		}	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   915
                CleanupStack::Pop(&mode);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   916
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   917
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   918
        
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   919
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   920
       	//Document is prsent
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   921
        if ( documentmap )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   922
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   923
            CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &path) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   924
            if (documentmap->FindL( KDocumentPath, path ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   925
            	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   926
            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   927
            		if ( ( path.AsDes().Length() > KMAXPATHLENGTH ) || !path.Get( document.iPath ) )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   928
						{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   929
	               	 	//content type is different: do cleanup, append error and return 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   930
	               	 	CleanupStack::Pop(&path);//path
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   931
	                    path.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   932
				         
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   933
                	 	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   934
                		aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   935
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   936
                		posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   937
                		return;		            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   938
	            		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   939
            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   940
            	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   941
            CleanupStack::Pop();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   942
            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   943
			CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &handle) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   944
	    	if (documentmap->FindL( KHandle, handle ) && (handle.TypeId() != LIW::EVariantTypeNull ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   945
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   946
            	if (!handle.Get( document.iHandle ))
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   947
                		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   948
	               	 	//do cleanup, append error and return 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   949
				        CleanupStack::Pop(&handle);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   950
				        handle.Reset() ;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   951
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   952
                	 	aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   953
                		aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); 	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   954
                		
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   955
                		posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   956
                		return;		            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   957
	            		}	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   958
            	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   959
               	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   960
            
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   961
            CleanupStack::Pop();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   962
            /*
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   963
            // The follwing code will be introduced once default file buffer is created
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   964
            CLiwBuffer* buffer = NULL;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   965
            buffer = handle.AsBuffer();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   966
            if ( KLiwBufferFile == buffer->TypeID() )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   967
                {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   968
                CLiwFileBuffer* filebuffer = ( CLiwFileBuffer* ) buffer;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   969
                document.iHandle = filebuffer->AsFile();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   970
                }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   971
            */
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   972
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   973
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   974
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   975
       TInt errCode;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   976
       //Converting command line form 16 to 8-bit
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   977
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   978
       HBufC8* heapBuffer = HBufC8::NewL( mimetype.Length() );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   979
       CleanupStack::PushL( heapBuffer );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   980
       TPtr8 mimetype8( heapBuffer->Des() );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   981
       mimetype8.Copy( mimetype );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   982
       TPtrC filename;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   983
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   984
       if( aCallBack )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   985
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   986
             //Asynch Call
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   987
             CAppServiceObserver* observer = CAppServiceObserver::NewL( aCallBack );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   988
             CleanupStack::PushL( observer );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   989
             TRAP ( errCode, iCoreClass->LaunchDocumentL( document, mimetype8, options , filename, observer,  aTransactionID  )  );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   990
             CleanupStack::Pop( observer );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   991
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   992
        else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   993
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   994
             TRAP ( errCode, iCoreClass->LaunchDocumentL(document, mimetype8, options , filename )  );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   995
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   996
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   997
        CleanupStack::PopAndDestroy( heapBuffer );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   998
        path.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   999
	    handle.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1000
	    mode.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1001
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1002
        TInt sapiErr = SErrNone;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1003
        if (errCode)
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1004
           {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1005
           sapiErr = SapiError( errCode );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1006
           }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1007
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1008
        aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( ( TInt32 ) sapiErr ) ));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1009
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1010
        if( filename.Length() != 0)
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1011
            {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1012
            aOutParamList.AppendL( TLiwGenericParam( KDocumentName, TLiwVariant( filename ) ));
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1013
            }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1014
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1015
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1016
     else
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1017
        {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1018
        //missig : Mandatory Argument
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1019
        aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( ( TInt32 ) SErrMissingArgument  ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1020
        aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KDocumentMissing ) ) );
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1021
        }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1022
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1023
       posbasedparam.Reset();
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1024
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1025
	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1026
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1027
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1028
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1029
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1030
// CAppManagerInterface::SapiError
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1031
// This function is called by the user to get mapped SAPI generic error code
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1032
// from symbian error codes .
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1033
// -----------------------------------------------------------------------------
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1034
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1035
TInt CAppManagerInterface::SapiError( TInt aSymbianErr )
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1036
    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1037
    TInt sapiErr(SErrGeneralError);
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1038
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1039
   	switch (aSymbianErr)
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1040
    	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1041
      	case KErrArgument:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1042
   		    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1043
   		    sapiErr = SErrBadArgumentType;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1044
   		    break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1045
   		    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1046
   		case KErrNotSupported:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1047
   		    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1048
   		    sapiErr = SErrServiceNotSupported;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1049
   		    break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1050
   		    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1051
   		case KErrServerBusy:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1052
   		    {
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1053
   		    sapiErr = SErrServerBusy;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1054
   		    break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1055
   		    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1056
    	case KErrGeneral:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1057
    	case KErrBadName: 
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1058
    		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1059
    		sapiErr = SErrGeneralError;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1060
   		    break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1061
   		    }
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1062
   		case KErrCancel:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1063
	   		{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1064
	   		sapiErr = SErrCancelSuccess;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1065
			break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1066
	   		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1067
		case KErrNone:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1068
			{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1069
			sapiErr= SErrNone;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1070
			break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1071
			}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1072
		case KErrNotFound:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1073
			{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1074
			sapiErr= SErrMissingArgument;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1075
			break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1076
			}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1077
		case KErrNoMemory:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1078
			{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1079
			sapiErr = SErrNoMemory;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1080
			break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1081
			}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1082
		case KErrInUse:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1083
			{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1084
			sapiErr = SErrServiceInUse;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1085
			break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1086
			}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1087
		case KErrNotReady:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1088
        	{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1089
        	sapiErr = SErrServiceNotReady;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1090
        	break;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1091
        	}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1092
		case KErrPathNotFound:
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1093
			{
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1094
			sapiErr = SErrPathNotFound ;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1095
        	break;	
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1096
			}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1097
   		}
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1098
    return sapiErr;
989d2f495d90 Revision: 200923
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
  1099
    }