defaultapplicationsettings/server/src/das_service.cpp
branchRCL_3
changeset 35 5f281e37a2f5
parent 0 254040eb3b7d
equal deleted inserted replaced
34:90fe62538f66 35:5f281e37a2f5
       
     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:  Implementation of the DefaultApp service
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //#include <eikstart.h> //for RDebug
       
    20 #include "das_server.h"
       
    21 #include "das_service.h"
       
    22 #include "das_app.h"
       
    23 #include "das_doc.h"
       
    24 #include "das_appui.h"
       
    25 #include "das_servmimeapps.h"
       
    26 
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // Default constructor
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CDefaultAppService::CDefaultAppService(const CDefaultAppServer* aServer) : iDefaultAppServer(aServer)
       
    35     {
       
    36     iClientUid=TUid::Uid(0);
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Destructor
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 CDefaultAppService::~CDefaultAppService()
       
    44     {
       
    45     delete iIdle;
       
    46     }
       
    47 // ---------------------------------------------------------------------------
       
    48 // Symbian 2-phased constructor
       
    49 // ---------------------------------------------------------------------------
       
    50 //    
       
    51 CDefaultAppService* CDefaultAppService::NewL(const CDefaultAppServer* aServer)
       
    52     {
       
    53     CDefaultAppService* self = new (ELeave) CDefaultAppService(aServer);
       
    54     return self;
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // From class CAknAppServiceBase.
       
    59 // function called when a new message is received
       
    60 // ---------------------------------------------------------------------------
       
    61 //            
       
    62 void CDefaultAppService::ServiceL(const RMessage2& aMessage)
       
    63     {
       
    64     switch (aMessage.Function())
       
    65         {
       
    66         case ESetDefaultAll : 
       
    67             HandleSetDefaultAllL(aMessage);
       
    68             break;        
       
    69         default:
       
    70             CAknAppServiceBase::ServiceL(aMessage);
       
    71         }
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // From class CAknAppServiceBase.
       
    76 // function called to check client credentials. Used to retrieve client app UID
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 CPolicyServer::TCustomResult CDefaultAppService::SecurityCheckL(const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/)
       
    80     {
       
    81     iClientUid=aMsg.SecureId();
       
    82     return CPolicyServer::EPass;
       
    83     }        
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // Sets default for all the Service & MIME pairs supported by the client
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void CDefaultAppService::HandleSetDefaultAllL(const RMessage2& aMessage)
       
    90     {
       
    91     //Get flags
       
    92     //TInt serviceFlags=aMessage.Int0();
       
    93     iServiceFlags=aMessage.Int0();
       
    94     aMessage.Complete(KErrNone);
       
    95     
       
    96 	if(!iIdle)
       
    97 	    {
       
    98 		iIdle=CIdle::NewL(CActive::EPriorityStandard);
       
    99 	    TCallBack cb(&IdleWorker,this);
       
   100 	    iIdle->Start(cb);
       
   101 	    };
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // Function where most of the processing happens.
       
   106 // We use it so that the service request from the client returns immediately
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 TInt CDefaultAppService::IdleWorker(TAny *aInstance)
       
   110 	{
       
   111 	CDefaultAppService *service=(CDefaultAppService*)aInstance;
       
   112 	//construct the view
       
   113 	if ( service->iDefaultAppServer && 
       
   114 		 service->iDefaultAppServer->iApp &&
       
   115 		 service->iDefaultAppServer->iApp->iDocument &&
       
   116 		 service->iDefaultAppServer->iApp->iDocument->iDefaultAppUi)
       
   117 	    {
       
   118 	    service->iDefaultAppServer->iApp->iDocument->iDefaultAppUi->ConstructSrvMimeDlgL(service->iClientUid,service->iServiceFlags);
       
   119 	    };
       
   120 	return 0; //no more work to do
       
   121 	}
       
   122 
       
   123 
       
   124    
       
   125