appinstaller/AppinstUi/Daemon/Src/silentuninstaller.cpp
changeset 0 ba25891c3a9e
child 25 7333d7932ef7
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "silentuninstaller.h"
       
    20 #include "SWInstDebug.h"
       
    21 #include "SWInstDefs.h"
       
    22 
       
    23 using namespace Swi;
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // C++ constructor
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 CSilentUninstaller::CSilentUninstaller( RFs& aFs )
       
    32     : iFs( aFs )
       
    33     {
       
    34     }
       
    35 
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // 2nd constructor
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 void CSilentUninstaller::ConstructL()
       
    42     {
       
    43     // Silently kill the app. if needed.
       
    44     FLOG(_L("[CSilentUninstaller] iKillApp = SwiUI::EPolicyAllowed;"));
       
    45     iOptions.iKillApp = SwiUI::EPolicyAllowed; 
       
    46     FLOG(_L("[CSilentUninstaller] iBreakDependency = SwiUI::EPolicyNotAllowed"));
       
    47     iOptions.iBreakDependency = SwiUI::EPolicyNotAllowed;         
       
    48     iOptionsPckg = iOptions;      
       
    49     }
       
    50 
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // Two-phased constructor.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CSilentUninstaller* CSilentUninstaller::NewL( RFs& aFs )
       
    57     {
       
    58     CSilentUninstaller* self = new( ELeave ) CSilentUninstaller( aFs );
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     CleanupStack::Pop( self );
       
    62     return self;    
       
    63     }
       
    64     
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // Destructor.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CSilentUninstaller::~CSilentUninstaller()
       
    71     {
       
    72     FLOG( _L("[CSilentUninstaller] ~CSilentUninstaller") );
       
    73     iLauncher.Close();
       
    74     }
       
    75 
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // Perform uninstallation.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void CSilentUninstaller::UninstallL( 
       
    82     TUid& aUid, 
       
    83     TRequestStatus& aReqStatus, 
       
    84     TDesC8& aMIME )
       
    85     {
       
    86     if ( !iConnected )
       
    87         {
       
    88         FLOG( _L("[CSilentUninstaller] Connect to server") );
       
    89         User::LeaveIfError( iLauncher.Connect() );
       
    90         iConnected = ETrue;            
       
    91         }                
       
    92     // Launch the installation
       
    93     FLOG( _L("[CSilentUninstaller] Launch uninstall") );
       
    94     iLauncher.SilentUninstall( aReqStatus, aUid, iOptionsPckg, aMIME );
       
    95     }
       
    96   
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // Cancel the current installation.
       
   100 // -----------------------------------------------------------------------------
       
   101 // 
       
   102 void CSilentUninstaller::Cancel()
       
   103     {
       
   104     FLOG( _L("[CSilentUninstaller] Cancel silet uninstall") );     
       
   105     iLauncher.CancelAsyncRequest( SwiUI::ERequestSilentUninstall );   
       
   106     }
       
   107 
       
   108 //  End of File