// -----------------------------------------------------------------------------
// CWidgetUiObserver::IsFileScheme
// -----------------------------------------------------------------------------
//
TBool CWidgetUiObserver::IsFileScheme( const TDesC& aFileName )
    {
    if ( aFileName.Length()> 0 && aFileName.Ptr() )
        {
        if ( aFileName.FindF(KFileScheme) == 0 )
            {
            return ETrue;
            }
        else
            {//Check for paths are that not URI, but of the form..
             // c:/dir/foo.txt. This is to accomodate browser engine inconsistencies. 
            TUriParser16 parser;
            if( parser.Parse( aFileName ) == KErrNone )
                {
                TPtrC16 scheme = parser.Extract( EUriScheme );
                // As per the URI RFC, the part before : is the Scheme
                if ( scheme.Length() == (KMaxDriveName-1) ) 
                    {
                    return ETrue;
                    }
                }
            }
        }

    return EFalse;
    }
void CAfActivityLauncherPrivate::launchActivityL(const TDesC &uriDesc)
{
    TUriParser16 parser;
    parser.Parse(uriDesc);

    if (parser.Extract(EUriScheme).Compare(_L("appto")) == 0) {
        TLex16 uidParser(parser.Extract(EUriHost));        
        TUint uid;
        User::LeaveIfError(uidParser.Val(uid, EHex));
        
        if (mApplicationLauncher.isRunning(TUid::Uid(uid))) {        
            CAfEntry *launchRequest = CAfEntry::NewLC(0, uid, uriDesc, KNullDesC(), KNullDesC(), KNullDesC8(), KNullDesC8(), TTime());
            User::LeaveIfError(mActivitiesClient->launchActivity(*launchRequest));
            CleanupStack::PopAndDestroy(launchRequest);
        } else {
            mApplicationLauncher.startApplicationL(TUid::Uid(uid), uriDesc);
        }        
    } else {
        User::Leave(KErrArgument);
    }
}