landmarksui/uicontrols/src/CLmkGoToUrlCmd.cpp
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     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:   This file contains methods which implements methods for
       
    15 *                interfacing with launching browser
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 // INCLUDE FILES
       
    25 #include <browserlauncher.h>
       
    26 #include <downloadedcontenthandler.h>
       
    27 #include "clmkgotourlcmd.h"
       
    28 
       
    29 _LIT(KProtocolForURL, "4 ");
       
    30 //============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // TLmkLauncherContentHandler::TLmkLauncherContentHandler
       
    34 // C++ default constructor can NOT contain any code, that
       
    35 // might leave.
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 TLmkLauncherContentHandler::TLmkLauncherContentHandler()
       
    39 	{
       
    40 	}
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // TLmkLauncherContentHandler::HandleContentL
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 TBool TLmkLauncherContentHandler::HandleContentL(const TDesC& /*aFileName*/,
       
    47 												 const CAiwGenericParamList& /*aParamList*/,
       
    48 												 TBool& aContinue )
       
    49 	{
       
    50 	aContinue = ETrue;
       
    51 	return EFalse;//ETrue;
       
    52 	}
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // TLmkLauncherContentHandler::DownloadedContentHandlerReserved
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 TAny* TLmkLauncherContentHandler::DownloadedContentHandlerReserved1( TAny* /*aAnyParam*/ )
       
    59 	{
       
    60 	// Empty
       
    61 	return NULL;
       
    62 	}
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // TLmkLauncherContentHandler::HandleServerAppExit
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void TLmkLauncherContentHandler::HandleServerAppExit( TInt /*aReason*/ )
       
    69 	{
       
    70 	}
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 //  CLmkGoToURLCmd::CLmkGoToURLCmd
       
    74 // C++ default constructor can NOT contain any code, that
       
    75 // might leave.
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78  CLmkGoToURLCmd::CLmkGoToURLCmd()
       
    79     {
       
    80     }
       
    81 
       
    82 // ----------------------------------------------------
       
    83 //  CLmkGoToURLCmd::ConstructL
       
    84 // ----------------------------------------------------
       
    85 //
       
    86 void CLmkGoToURLCmd::ConstructL( )
       
    87     {
       
    88      /* Nothing right now */
       
    89 
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CLmkGoToURLCmd::NewL
       
    94 // Two-phased constructor.
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C CLmkGoToURLCmd* CLmkGoToURLCmd::NewL()
       
    98     {
       
    99     CLmkGoToURLCmd* self =
       
   100         new( ELeave ) CLmkGoToURLCmd;
       
   101     CleanupStack::PushL( self );
       
   102     self->ConstructL();
       
   103     CleanupStack::Pop();
       
   104     return self;
       
   105     }
       
   106 
       
   107 // ----------------------------------------------------
       
   108 // CLmkGoToURLCmd::~CLmkGoToURLCmd()
       
   109 // ----------------------------------------------------
       
   110 //
       
   111 CLmkGoToURLCmd::~CLmkGoToURLCmd()
       
   112     {
       
   113     delete iContentHandler;
       
   114 	delete iLauncher;
       
   115     }
       
   116 
       
   117 // ----------------------------------------------------
       
   118 // CLmkGoToURLCmd::LaunchBrowserL()
       
   119 // ----------------------------------------------------
       
   120 //
       
   121 void CLmkGoToURLCmd::LaunchBrowserL(const TDesC& aUrl)
       
   122 	{
       
   123 	delete iContentHandler;
       
   124 	delete iLauncher;
       
   125 
       
   126 	iContentHandler = NULL;
       
   127 	iLauncher = NULL;
       
   128 
       
   129 	/**
       
   130 	* From the Browser API specification
       
   131 	* 4 means that there is URL coming after that.
       
   132 	* So the message format is "4 http://www.mydomain.com".
       
   133 	*/
       
   134 
       
   135 	HBufC* parameter = HBufC::NewLC( KProtocolForURL().Length() +  aUrl.Length() );
       
   136 	parameter->Des().Copy( KProtocolForURL );
       
   137 	parameter->Des().Append( aUrl );
       
   138 	iContentHandler = new (ELeave) TLmkLauncherContentHandler;
       
   139 	iLauncher = CBrowserLauncher::NewL();
       
   140 	iLauncher->LaunchBrowserEmbeddedL( *parameter, iContentHandler, iContentHandler );
       
   141 	CleanupStack::PopAndDestroy(parameter);
       
   142 	}
       
   143 
       
   144 //  End of File