idlefw/plugins/shortcutplugin/src/taiscutparser.cpp
branchRCL_3
changeset 8 d0529222e3f0
parent 4 1a2a00e78665
child 11 bd874ee5e5e2
equal deleted inserted replaced
4:1a2a00e78665 8:d0529222e3f0
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Shortcut definition parser
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "taiscutparser.h"
       
    20 #include "aiscutdefs.h"
       
    21 
       
    22 #include "debug.h"
       
    23 
       
    24 
       
    25 // ======== LOCAL FUNCTIONS ========
       
    26 /**
       
    27  * Extract a value with the given name from a URI query string.
       
    28  * For example a query string of ?view=1234&iconid=3;5&foo=bar
       
    29  * and we wanted iconid from that string. Function places the 3;5 
       
    30  * into aValue and if needed deletes the "iconid=3;5&" string from the
       
    31  * query string.
       
    32  *
       
    33  * @param aQueryString The querystring
       
    34  * @param aParameterName The name of the parameter to find
       
    35  * @param aValue Where to place the value
       
    36  * @param aRemoveNameAndValue ETrue to remove the name=value from the querystring
       
    37  * @return KErrNone on succesful extraction. KErrNotFound if the parameter was not found
       
    38 */
       
    39 TInt ExtractValueFromQueryString( TDes &aQueryString, const TDesC &aParameterName,
       
    40     TDes &aValue, TBool aRemoveNameAndValue )
       
    41     {
       
    42     TInt err = KErrNone;
       
    43     HBufC *tempBuffer = aQueryString.Alloc();
       
    44     if ( !tempBuffer )
       
    45         {
       
    46         return KErrNoMemory;
       
    47         }
       
    48     
       
    49     TPtr temp = tempBuffer->Des();
       
    50     
       
    51     TInt foundStartPos = 0;
       
    52     TInt foundStopPos = 0;
       
    53     foundStartPos =  aQueryString.FindC(aParameterName);
       
    54     if ( foundStartPos != KErrNotFound )
       
    55         {
       
    56         // remove the beginning of the string from temp, so no additional &-marks are found
       
    57         // at the start of string
       
    58         temp.Delete(0,foundStartPos);
       
    59 
       
    60         foundStopPos = temp.Locate(KParamNextSeparator);
       
    61         // stop either at the eos or at the next & mark
       
    62         foundStopPos = (foundStopPos != KErrNotFound ) ? (foundStopPos): (temp.Length() );
       
    63         // start after the = separator and stop either on eos or at & mark
       
    64         TInt from = (aParameterName.Length() + 1);
       
    65         TInt length = foundStopPos - from;
       
    66 
       
    67         // Get just the value part
       
    68         if ( aValue.MaxLength() >= length )
       
    69             {
       
    70             aValue = temp.Mid( from, length );
       
    71             }
       
    72         else // Can't place the value to aValue string
       
    73             {            
       
    74             err = KErrNoMemory;
       
    75             }
       
    76 
       
    77         if ( err == KErrNone && aRemoveNameAndValue )
       
    78             {
       
    79             // Delete the aParameterName=aValue string from the querystring
       
    80             // If eos reached then we need to delete the & before us also
       
    81             // Don't try to delete if this is an only parameter
       
    82             if ( foundStopPos == temp.Length() && foundStartPos > 0 )
       
    83                 {
       
    84                 aQueryString.Delete(foundStartPos - 1, (foundStopPos + 1));
       
    85                 }
       
    86             else
       
    87                 {
       
    88                 aQueryString.Delete(foundStartPos, (foundStopPos + 1));
       
    89                 }
       
    90             }        
       
    91         }
       
    92     else
       
    93         {
       
    94         err = KErrNotFound;
       
    95         }
       
    96     
       
    97     delete tempBuffer;
       
    98     return err;
       
    99     }
       
   100 
       
   101 /**
       
   102  * Tests if string ends with given pattern
       
   103  * 
       
   104  * @param aString input string
       
   105  * @param aPattern test pattern
       
   106  * @return ETrue if string ends with given pattern.
       
   107  */
       
   108 TBool EndsWith( const TDesC& aString, const TDesC& aPattern )
       
   109     {
       
   110     TBuf<10> temp(aString.Right(aPattern.Length()));
       
   111     return ( aString.Right( aPattern.Length() ) == aPattern );
       
   112     }    
       
   113     
       
   114 /**
       
   115  * Resolves skin item id from pattern majorId;minorId;colourGroupId.
       
   116  * The colourGroupId in the syntax is optional, and if no value found then
       
   117  * aColourValue will be -1
       
   118  *
       
   119  * @param aPath   skin item id string     
       
   120  * @param aItemId skin item id to fill
       
   121  * @param aColourValue colour value to fill. 
       
   122  * 
       
   123  * @return ETrue if id was succesfully parsed.
       
   124  */
       
   125 TBool ResolveSkinItemId( const TDesC& aPath, TAknsItemID& aItemId, TInt& aColourValue )
       
   126     {
       
   127     // Syntax: major;minor;colourgroup    
       
   128     aColourValue = -1;
       
   129   
       
   130     // Initialize lexer
       
   131     TLex lex( aPath );
       
   132     lex.SkipSpace();
       
   133 
       
   134     TInt majorId( 0 );        
       
   135     TInt minorId( 0 );
       
   136     
       
   137     // Resolve major id        
       
   138     TInt error = lex.Val( majorId );
       
   139     
       
   140     // Resolve minor id
       
   141     if ( lex.Eos())
       
   142         return KErrNotFound;
       
   143     
       
   144     lex.Inc();
       
   145     error |= lex.Val( minorId );
       
   146     
       
   147     // initilize skin item id object
       
   148     aItemId.Set( majorId, minorId );
       
   149     
       
   150     if ( lex.Eos())
       
   151         return KErrNotFound;
       
   152     lex.Inc();
       
   153 
       
   154     TInt colorError = lex.Val( aColourValue );
       
   155     if ( colorError != KErrNone || aColourValue < 0)
       
   156         {
       
   157         aColourValue = -1;
       
   158         }
       
   159                 
       
   160     // Check error
       
   161     return ( error == KErrNone );
       
   162 
       
   163     }
       
   164     
       
   165 /**
       
   166 * Resolves filename and id from syntax
       
   167 * filename.ext;id. If the syntax is incorrect
       
   168 * aId is -1 and filename zeroed and EFalse is returned
       
   169 * MIF and MBM supported.
       
   170 *
       
   171 * @param aPath The path to extract the data from
       
   172 * @param aId    Id to fill
       
   173 * @param aFilename Filename to fill
       
   174 * @return ETrue if id and path was succesfully parsed.
       
   175 */
       
   176 TBool ResolveFileIdAndPath( const TDesC& aPath, TInt& aId, TDes& aFilename )
       
   177 {
       
   178     // Syntax: filename.ext;index
       
   179     // Supported: MIF, MBM
       
   180     TInt pos = aPath.FindF( KScutSkinItemSeparator );
       
   181     aFilename.Zero();
       
   182     if( pos != KErrNotFound )
       
   183         {
       
   184         aFilename = (aPath.Left(pos));
       
   185         
       
   186         if ( ( !EndsWith(aFilename, KScutMIFExtension ) ) &&
       
   187              ( !EndsWith(aFilename, KScutMBMExtension ) )   )
       
   188         	{
       
   189         	aFilename.Zero();
       
   190         	return EFalse;
       
   191         	}
       
   192         
       
   193         TLex lex(aPath.Mid(pos+1));
       
   194         TInt error = lex.Val(aId);
       
   195         if ( error != KErrNone )
       
   196         	{
       
   197         	aId = -1;
       
   198         	return EFalse;
       
   199         	}
       
   200         return ETrue;
       
   201         }
       
   202     return EFalse;
       
   203 }     
       
   204 
       
   205 TInt CreateChecksumFromString( const TDesC& aString )
       
   206     {
       
   207     TInt checksum = 0;
       
   208     
       
   209     for ( TInt i = 0; i < aString.Length(); i++ )
       
   210         {
       
   211         checksum += aString[i] * ( i + 1);
       
   212         }
       
   213     return checksum;       
       
   214     }
       
   215 
       
   216 // ======== MEMBER FUNCTIONS ========
       
   217 
       
   218 // ---------------------------------------------------------------------------
       
   219 //
       
   220 // ---------------------------------------------------------------------------
       
   221 //
       
   222 TAiScutParser::TAiScutParser() : iType(EScutUnknown), iUid(KNullUid)
       
   223 {
       
   224 }
       
   225 
       
   226 
       
   227 // -----------------------------------------------------------------------------
       
   228 // Static utility function to parse an uid from the given descriptor.
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 TUid TAiScutParser::ParseUid(const TDesC& aDesC)
       
   232 {
       
   233     TRadix radix(EDecimal);
       
   234 
       
   235     // Check if the number is in hexadecimal format.
       
   236     _LIT(KHexPrefix, "0x");
       
   237     const TInt prefixLen = 2;
       
   238     TPtrC ptr(aDesC);
       
   239 
       
   240     if (ptr.Left(prefixLen).CompareC(KHexPrefix) == 0)
       
   241     {
       
   242         // Strip the '0x' prefix.
       
   243         ptr.Set(ptr.Right(ptr.Length() - prefixLen));
       
   244 
       
   245         radix = EHex;
       
   246     }
       
   247 
       
   248     // Do the actual parsing.
       
   249     TUint uint;
       
   250     TUid uid(KNullUid);
       
   251     TLex lexer(ptr);
       
   252     TInt err = lexer.Val(uint, radix);
       
   253     if (err == KErrNone)
       
   254     {
       
   255         uid.iUid = uint;
       
   256     }
       
   257 
       
   258     return uid;
       
   259 }
       
   260 
       
   261 
       
   262 // ---------------------------------------------------------------------------
       
   263 // Parses a shortcut definition.
       
   264 // ---------------------------------------------------------------------------
       
   265 //
       
   266 TInt TAiScutParser::Parse(const TDesC& aDefinition)
       
   267 {
       
   268     iType = EScutUnknown;
       
   269     iDefinition.Set(aDefinition);
       
   270     
       
   271     // Default values for the icon
       
   272     iIcon.iIconId = KErrNotFound;
       
   273     iIcon.iPath.Zero();
       
   274     iIcon.iSkinId.iMajor = -1;
       
   275     iIcon.iSkinId.iMinor = -1;
       
   276     iIcon.iColourGroup = -1;
       
   277     
       
   278     iIcon.iType = EScutIconNone;
       
   279     iIcon.iDestination = EScutDestinationNormal;
       
   280     iIcon.iShortcutType = EScutUnknown;
       
   281     iIcon.iAppUid = TUid::Uid(0);
       
   282     iIcon.iViewId = TUid::Uid(0);
       
   283     
       
   284     TInt err = iUriParser.Parse(aDefinition);
       
   285     if (err != KErrNone)
       
   286     {
       
   287         return err;
       
   288     }
       
   289 
       
   290     TPtrC scheme(iUriParser.Extract(EUriScheme));
       
   291 
       
   292     if (scheme.Length() == 0 ||
       
   293         scheme.Compare(KScutURISchemeHttp) == 0 ||
       
   294         scheme.Compare(KScutURISchemeHttps) == 0)
       
   295     {
       
   296         ParseParams();
       
   297         iType = EScutWebAddress;
       
   298         
       
   299         if ( iIcon.iType != EScutIconNone )
       
   300             {
       
   301             // create a checksum for unique identifying
       
   302             TInt checksum = CreateChecksumFromString( aDefinition );
       
   303             iIcon.iViewId = TUid::Uid( checksum );
       
   304             iIcon.iShortcutType = iType;
       
   305             iIcon.iAppUid = KScutBrowserUid;           
       
   306             }
       
   307         err = KErrNone;
       
   308     }
       
   309     else if (scheme.Compare(KScutURISchemeLocalApp) == 0)
       
   310     {
       
   311         iType = EScutApplication;
       
   312 
       
   313         if (!ParseAlias())
       
   314         {
       
   315             iUid = ParseUid(iUriParser.Extract(EUriPath));
       
   316         }
       
   317 
       
   318         if (iUid == KScutAppShellUid)
       
   319         {
       
   320             // appshell shortcut is always of type app view.
       
   321             iType = EScutApplicationView;
       
   322         }
       
   323 
       
   324         // ParseParams() parses params from an URL. If it encounters
       
   325         // iconid, iconmifpath or cba parameter from the URL, then it
       
   326         // places the values to iIcon and removes the parameters from
       
   327         // the URL. It also extract the additional viewid if needed.
       
   328         // For example bookmarks and apps with views use them. 
       
   329 
       
   330         ParseParams();
       
   331         // Icon found so apply the appuid and type to icon. 
       
   332         if ( iIcon.iType != EScutIconNone )
       
   333             {
       
   334             iIcon.iShortcutType = iType;
       
   335             
       
   336             // If we are dealing with messaging icons then the 
       
   337             // appuid needs to be changed in order to match it against
       
   338             // the shortcuts appuid
       
   339             switch( iType )
       
   340                 { 
       
   341                 case EScutNewMessage:
       
   342                     iIcon.iAppUid.iUid = KScutUnifiedEditorUidValue;
       
   343                     break;
       
   344 
       
   345                 case EScutNewEmail:
       
   346                     iIcon.iAppUid.iUid = KScutEmailEditorUidValue;
       
   347                     break;
       
   348 
       
   349             #ifdef __SYNCML_DS_EMAIL
       
   350                 case EScutNewSyncMLMail:
       
   351                     iIcon.iAppUid.iUid = KScutEmailEditorUidValue; 
       
   352                     iIcon.iViewId.iUid = KScutSyncMlEmailUidValue;
       
   353                     break;
       
   354             #endif
       
   355 
       
   356                 case EScutNewPostcard:
       
   357                     iIcon.iAppUid.iUid = KScutPostcardEditorUidValue;
       
   358                     break;
       
   359 
       
   360                 case EScutNewAudioMsg:
       
   361                     iIcon.iAppUid.iUid = KScutAmsEditorUidValue;
       
   362                     break;
       
   363 
       
   364                 case EScutNewMsgType:
       
   365                     iIcon.iAppUid.iUid = KScutMessagingCenterUidValue;
       
   366                     iIcon.iViewId.iUid = KScutMessagingCenterUidValue;
       
   367                     break;
       
   368                     
       
   369                 default:
       
   370                     iIcon.iAppUid = iUid;       
       
   371                     break;
       
   372                
       
   373                 }
       
   374                  
       
   375             }
       
   376         err = KErrNone;
       
   377     }
       
   378     else
       
   379     {
       
   380         err = KErrCorrupt;
       
   381     }
       
   382 
       
   383 	__PRINTS( "XAI: TAiScutParser::Parse");
       
   384 	__PRINT( __DBG_FORMAT( "XAI:   type = %d, definition = '%S', err = %d"), iType, &aDefinition, err);
       
   385     return err;
       
   386 }
       
   387 
       
   388 
       
   389 // ---------------------------------------------------------------------------
       
   390 // Checks if the shortcut definition was valid.
       
   391 // ---------------------------------------------------------------------------
       
   392 //
       
   393 TBool TAiScutParser::IsValid() const
       
   394 {
       
   395     return iType != EScutUnknown;
       
   396 }
       
   397 
       
   398 
       
   399 // -----------------------------------------------------------------------------
       
   400 // Returns the shortcut target type.
       
   401 // -----------------------------------------------------------------------------
       
   402 //
       
   403 TShortcutType TAiScutParser::Type() const
       
   404 {
       
   405     return iType;
       
   406 }
       
   407 
       
   408 
       
   409 // -----------------------------------------------------------------------------
       
   410 // Returns the shortcut target uid. Used for application shortcuts.
       
   411 // -----------------------------------------------------------------------------
       
   412 //
       
   413 TUid TAiScutParser::Uid() const
       
   414 {
       
   415     return iUid;
       
   416 }
       
   417 
       
   418 
       
   419 TAiScutIcon TAiScutParser::Icon() const
       
   420     {
       
   421     return iIcon;
       
   422     }
       
   423 // -----------------------------------------------------------------------------
       
   424 // Returns a shortcut definition component value.
       
   425 // -----------------------------------------------------------------------------
       
   426 //
       
   427 TPtrC TAiScutParser::Get(TScutDefComponent aComponent) const
       
   428 {
       
   429     TPtrC componentValue;
       
   430 
       
   431     switch (aComponent)
       
   432     {
       
   433     case EScutDefScheme:
       
   434         componentValue.Set(iUriParser.Extract(EUriScheme));
       
   435         break;
       
   436 
       
   437     case EScutDefTarget:
       
   438         componentValue.Set(iUriParser.Extract(EUriPath));
       
   439         break;
       
   440 
       
   441     case EScutDefParamName:
       
   442         componentValue.Set(iParamName);
       
   443         break;
       
   444 
       
   445     case EScutDefParamValue:
       
   446         componentValue.Set(iParamValue);
       
   447         break;
       
   448 
       
   449     case EScutDefParamNameAndValue:
       
   450         componentValue.Set(iUriParser.Extract(EUriQuery));
       
   451         break;
       
   452 
       
   453     case EScutDefComplete:
       
   454         componentValue.Set(iDefinition);
       
   455         break;
       
   456 
       
   457     default:
       
   458         break;
       
   459     }
       
   460 
       
   461     return componentValue;
       
   462 }
       
   463 
       
   464 
       
   465 // ---------------------------------------------------------------------------
       
   466 // Composes a shortcut definition string from given parameters.
       
   467 // ---------------------------------------------------------------------------
       
   468 //
       
   469 void TAiScutParser::ComposeL(HBufC*& aDes, const TUid aUid,
       
   470     const TDesC& aParamName, const TDesC& aParamValue)
       
   471 {
       
   472     HBufC* temp = HBufC::NewLC(KMaxDefinitionLength);
       
   473     TPtr ptr = temp->Des();
       
   474 
       
   475     if (aParamName.Length() && aParamValue.Length())
       
   476     {
       
   477         ptr.Format(KScutFormatApplicationWithParams, aUid.iUid, &aParamName, &aParamValue);
       
   478     }
       
   479     else
       
   480     {
       
   481         ptr.Format(KScutFormatApplication, aUid.iUid);
       
   482     }
       
   483 
       
   484     aDes = temp->AllocL();
       
   485     CleanupStack::PopAndDestroy(temp);
       
   486 }
       
   487 
       
   488 
       
   489 // ---------------------------------------------------------------------------
       
   490 // Composes a shortcut definition string from given parameters.
       
   491 // ---------------------------------------------------------------------------
       
   492 //
       
   493 void TAiScutParser::ComposeL(HBufC*& aDes, const TUid aUid,
       
   494     const TDesC& aParamString)
       
   495 {
       
   496     HBufC* temp = HBufC::NewLC(KMaxDefinitionLength);
       
   497     TPtr ptr = temp->Des();
       
   498 
       
   499     if (aParamString.Length())
       
   500     {
       
   501         ptr.Format(KScutFormatApplicationWithParamString, aUid.iUid, &aParamString);
       
   502     }
       
   503     else
       
   504     {
       
   505         ptr.Format(KScutFormatApplication, aUid.iUid);
       
   506     }
       
   507 
       
   508     aDes = temp->AllocL();
       
   509     CleanupStack::PopAndDestroy(temp);
       
   510 }
       
   511 
       
   512 
       
   513 // ---------------------------------------------------------------------------
       
   514 // Checks if an alias was used in shortcut definition and parses an uid from it.
       
   515 // ---------------------------------------------------------------------------
       
   516 //
       
   517 TBool TAiScutParser::ParseAlias()
       
   518 {
       
   519     TPtrC ptr(iUriParser.Extract(EUriPath));
       
   520 
       
   521     // "localapp:msg?..." is an alias for messaging application.
       
   522     if (ptr.CompareC(KScutTargetAliasMessaging) == 0)
       
   523     {
       
   524         iUid = KScutMessagingUid;
       
   525         return ETrue;
       
   526     }
       
   527     // "localapp:keylock?..." is an alias for keylock
       
   528     else if (ptr.CompareC(KScutTargetAliasKeylock) == 0)
       
   529     {
       
   530         iUid = KScutKeyLockUid;
       
   531         return ETrue;
       
   532     }
       
   533 
       
   534     // "localapp:voicedial..." is an alias for voicedial
       
   535     else if (ptr.CompareC(KScutTargetAliasVoiceDial) == 0)
       
   536     {
       
   537         iUid = KScutVoiceDialUid;
       
   538         return ETrue;
       
   539     }
       
   540 
       
   541     // "localapp:logs?..." is an alias for logs
       
   542     else if (ptr.CompareC(KScutTargetAliasLogs) == 0)
       
   543     {
       
   544         iUid = KScutLogsUid;
       
   545         return ETrue;
       
   546     }
       
   547     else
       
   548     {
       
   549         return EFalse;
       
   550     }
       
   551 }
       
   552 
       
   553 
       
   554 // ---------------------------------------------------------------------------
       
   555 // Parses the possible application shortcut parameters.
       
   556 // ---------------------------------------------------------------------------
       
   557 //
       
   558 void TAiScutParser::ParseParams()
       
   559 {
       
   560     TPtrC params(iUriParser.Extract(EUriQuery));
       
   561     
       
   562     if (params.Length() > 0)
       
   563     {        
       
   564         HBufC *tempParams = params.Alloc();
       
   565         // value can't be longer than the params
       
   566         // but in some cases it can be equally long
       
   567         HBufC *value = HBufC::New(params.Length());
       
   568         
       
   569         // low memory or similar situation so cannot do anything
       
   570         if ( !value || !tempParams )
       
   571             {
       
   572             return;
       
   573             }
       
   574         
       
   575         TPtr valuePtr = value->Des();
       
   576         TPtr tempParamsPtr = tempParams->Des();
       
   577         
       
   578         TBool addonFound = EFalse;
       
   579         TInt err = KErrNone;
       
   580         
       
   581         // First extract the CBA
       
   582         err = ExtractValueFromQueryString(tempParamsPtr,KScutParamNameCBAIcon,valuePtr, ETrue);               
       
   583         if ( err == KErrNone )
       
   584             {
       
   585             iIcon.iDestination = EScutDestinationSoftkey;
       
   586             }
       
   587         // Then the toolbar
       
   588 
       
   589         err = ExtractValueFromQueryString(tempParamsPtr,KScutParamNameToolbarIcon,valuePtr, ETrue);               
       
   590 
       
   591         if ( err == KErrNone )
       
   592             {
       
   593             iIcon.iDestination = EScutDestinationToolbar;
       
   594             }
       
   595         
       
   596         // then extract the iconskinid
       
   597         err = ExtractValueFromQueryString(tempParamsPtr,
       
   598                 KScutParamNameIconSkinId,valuePtr, ETrue);
       
   599         if ( err == KErrNone &&
       
   600                 ResolveSkinItemId(valuePtr,iIcon.iSkinId,iIcon.iColourGroup))
       
   601             {
       
   602             iIcon.iType = EScutIconSkin;
       
   603             addonFound = ETrue;
       
   604             }
       
   605         // Then extract the iconmifpath
       
   606         // Iconmifpath extraction left here for backward compatibility
       
   607         valuePtr.Zero();
       
   608         err = ExtractValueFromQueryString(tempParamsPtr,
       
   609                 KScutParamNameIconMifPath,valuePtr, ETrue);
       
   610         if ( err == KErrNone &&
       
   611                 ResolveFileIdAndPath(valuePtr,iIcon.iIconId,iIcon.iPath) )
       
   612             {
       
   613             iIcon.iType = EScutIconMif;
       
   614             addonFound = ETrue;
       
   615             }        
       
   616 
       
   617         // Then extract the iconpath.
       
   618         valuePtr.Zero();
       
   619         err = ExtractValueFromQueryString(tempParamsPtr,
       
   620                 KScutParamNameIconPath,valuePtr, ETrue);
       
   621         if ( err == KErrNone &&
       
   622                 ResolveFileIdAndPath(valuePtr,iIcon.iIconId,iIcon.iPath) )
       
   623             {
       
   624             if ( EndsWith(iIcon.iPath, KScutMIFExtension ))
       
   625                 {
       
   626                 iIcon.iType = EScutIconMif;                
       
   627                 }
       
   628             else if ( EndsWith(iIcon.iPath, KScutMBMExtension ))
       
   629                 {
       
   630                 iIcon.iType = EScutIconMbm;
       
   631                 } 
       
   632             addonFound = ETrue;
       
   633             } 
       
   634                    
       
   635         // Use the new params string where the addons 
       
   636         // have been removed
       
   637         if( addonFound )
       
   638             {
       
   639             params.Set(tempParamsPtr);   
       
   640             // no need to process anything because there are no
       
   641             // parameters left after our addons have been taken out
       
   642             if ( params.Length() <= 0)
       
   643                 {
       
   644                 delete value;
       
   645                 delete tempParams;
       
   646                 return;
       
   647                 }
       
   648             }
       
   649         
       
   650         delete value;
       
   651         
       
   652         iType = EScutApplicationWithParams;
       
   653         
       
   654         const TInt valueSeparatorPos = params.Locate(KParamValueSeparator);
       
   655 
       
   656         if (valueSeparatorPos >= 0)
       
   657         {
       
   658             iParamName.Set(params.Left(valueSeparatorPos));
       
   659         }
       
   660         if (valueSeparatorPos >= 0)
       
   661         {
       
   662             iParamValue.Set(params.Mid(valueSeparatorPos + 1));
       
   663         }
       
   664         if (valueSeparatorPos == -1)
       
   665         {
       
   666             iParamName.Set(params);
       
   667         }
       
   668 
       
   669         if (iParamName.CompareC(KScutParamNameView) == 0)
       
   670         {
       
   671             iType = EScutApplicationView;
       
   672 
       
   673             if (iUid == KScutPersonalisationUid)
       
   674             {
       
   675                 TUid uid = ParseUid(iParamValue);
       
   676                 if (uid == KScutChangeThemeViewId)
       
   677                 {
       
   678                     iType = EScutChangeTheme;
       
   679                 }
       
   680                 iIcon.iViewId = uid;
       
   681             }
       
   682 
       
   683             if (iUid == KScutLogsUid)
       
   684             {
       
   685                 if (iParamValue.CompareC(KScutParamValueMissedCalls) == 0)
       
   686                 {
       
   687                     iType = EScutLogsMissedCallsView;
       
   688                 }
       
   689                 else if (iParamValue.CompareC(KScutParamValueDialledCalls) == 0)
       
   690                 {
       
   691                     iType = EScutLogsDialledCallsView;
       
   692                 }
       
   693                 else if (iParamValue.CompareC(KScutParamValueReceivedCalls) == 0)
       
   694                 {
       
   695                     iType = EScutLogsReceivedCallsView;
       
   696                 }
       
   697                 else if (iParamValue.CompareC(KScutParamValueMainView) == 0)
       
   698                 {
       
   699                     iType = EScutLogsMainView;
       
   700                 }
       
   701             }
       
   702 
       
   703             if (iUid == KScutGeneralSettingsUid)
       
   704             {
       
   705                 if (ParseUid(iParamValue) == KScutParamValueConnectivityView)
       
   706                 {
       
   707                     iType = EScutConnectivityStatusView;
       
   708                 }
       
   709                 else if (ParseUid(iParamValue) == KScutInstallationViewId)
       
   710                 {
       
   711                     iType = EScutApplicationManagerView;
       
   712                 }
       
   713             }
       
   714             
       
   715             
       
   716         }
       
   717         else if (iUid == KScutMessagingUid)
       
   718         {
       
   719             if (iParamName.CompareC(KScutParamNameNew) == 0)
       
   720             {
       
   721                 if (iParamValue.CompareC(KScutParamValueMsg) == 0)
       
   722                 {
       
   723                     iType = EScutNewMessage;
       
   724                 }
       
   725                 else if (iParamValue.CompareC(KScutParamValueEmail) == 0)
       
   726                 {
       
   727                     iType = EScutNewEmail;
       
   728                 }
       
   729 #ifdef __SYNCML_DS_EMAIL
       
   730                 else if (iParamValue.CompareC(KScutParamValueSyncMLMail) == 0)
       
   731                 {
       
   732                     iType = EScutNewSyncMLMail;
       
   733                 }
       
   734 #endif
       
   735                 else if (iParamValue.CompareC(KScutParamValuePostcard) == 0)
       
   736                 {
       
   737                     iType = EScutNewPostcard;
       
   738                 }
       
   739                 else if (iParamValue.CompareC(KScutParamValueAudioMsg) == 0)
       
   740                 {
       
   741                     iType = EScutNewAudioMsg;
       
   742                 }
       
   743                 else
       
   744                 {
       
   745                     iType = EScutNewMsgType;
       
   746                 }
       
   747             }
       
   748             else if (iParamName.CompareC(KScutParamNameMailbox) == 0)
       
   749             {
       
   750                 iType = EScutMailbox;
       
   751             }
       
   752         }
       
   753         else if (iUid == KScutKeyLockUid)
       
   754         {
       
   755             iType = EScutKeylock;
       
   756         }
       
   757         else if (iUid == KScutSettingsDllUid || iUid == KScutBrowserUid)
       
   758         {
       
   759             if (iParamName.CompareC(KScutParamNameBookmark) == 0)
       
   760             {
       
   761                 iType = EScutBookmark;
       
   762                 iIcon.iViewId = ParseUid(iParamValue);
       
   763             }
       
   764             else if (iParamName.CompareC(KScutParamNoEffect) == 0)
       
   765             {
       
   766                 iType = EScutNoEffect;
       
   767             }
       
   768         }
       
   769         delete tempParams;
       
   770     }
       
   771 }
       
   772 
       
   773 TInt TAiScutParser::ChecksumForString( const TDesC& aDefinition) const 
       
   774     {
       
   775     return CreateChecksumFromString( aDefinition );
       
   776     }
       
   777 
       
   778 TInt TAiScutParser::CustomTitle( TDes& aTarget ) const
       
   779     {
       
   780     TPtrC params(iUriParser.Extract(EUriQuery));
       
   781     HBufC *tempParams = params.Alloc();
       
   782     if ( !tempParams )
       
   783         {
       
   784         return KErrNoMemory;
       
   785         }
       
   786         
       
   787     TPtr tempParamsPtr = tempParams->Des();
       
   788     
       
   789     TInt err = ExtractValueFromQueryString(tempParamsPtr,
       
   790             KScutParamNameCustomTitle, aTarget, EFalse);
       
   791     
       
   792     delete tempParams;
       
   793     return err;
       
   794     }
       
   795 
       
   796 void TAiScutParser::RemoveExtraDefinitionsL( TDes &aString ) const
       
   797     {
       
   798     HBufC *temp = HBufC::NewL( aString.Length( ));
       
   799     TPtr tempPtr = temp->Des();
       
   800     ExtractValueFromQueryString(aString,
       
   801                     KScutParamNameCBAIcon, tempPtr, ETrue);
       
   802     
       
   803     ExtractValueFromQueryString(aString,
       
   804                 KScutParamNameIconSkinId,tempPtr, ETrue);
       
   805     
       
   806     ExtractValueFromQueryString(aString,
       
   807                 KScutParamNameIconMifPath,tempPtr, ETrue);
       
   808     
       
   809     ExtractValueFromQueryString(aString,
       
   810                 KScutParamNameCustomTitle, tempPtr, ETrue);
       
   811     ExtractValueFromQueryString(aString,
       
   812                 KScutParamNameIconPath, tempPtr, ETrue);
       
   813     delete temp;
       
   814     }
       
   815 
       
   816 // End of File.