appinstaller/AppinstUi/Plugin/SisxUI/Src/SisxUI.cpp
changeset 80 9dcba1ee99f7
parent 77 d1838696558c
equal deleted inserted replaced
77:d1838696558c 80:9dcba1ee99f7
     1 /*
       
     2 * Copyright (c) 2002-2008 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 the implementation of CSisxUI
       
    15 *                class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <bautils.h>
       
    22 #include <eikenv.h>
       
    23 #include <data_caging_path_literals.hrh>
       
    24 #include <SisxUIData.rsg>
       
    25 
       
    26 #include "SisxUI.h"
       
    27 #include "SisxUIOperationWatcher.h"
       
    28 #include "SisxUIAppInfo.h"
       
    29 #include "SWInstDebug.h"
       
    30 #include "CUIUtils.h"
       
    31 
       
    32 using namespace SwiUI;
       
    33 
       
    34 _LIT( KSisxUIResourceFileName, "sisxuiData.rsc" );
       
    35 _LIT( KSisxUIResourceDir, "\\Resource\\" );
       
    36 
       
    37 // ============================ MEMBER FUNCTIONS ===============================
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CSisxUI::CSisxUI
       
    41 // C++ default constructor can NOT contain any code, that
       
    42 // might leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 CSisxUI::CSisxUI()
       
    46     {
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CSisxUI::ConstructL
       
    51 // Symbian 2nd phase constructor can leave.
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 void CSisxUI::ConstructL()
       
    55     {
       
    56     TFileName fileName;
       
    57     fileName.Append( KSisxUIResourceDir );
       
    58     fileName.Append( KSisxUIResourceFileName );
       
    59     iResourceFileOffset = CommonUI::CUIUtils::LoadResourceFileL( fileName, CEikonEnv::Static() );
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CSisxUI::NewL
       
    64 // Two-phased constructor.
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 CSisxUI* CSisxUI::NewL()
       
    68     {
       
    69     CSisxUI* self = new( ELeave ) CSisxUI();
       
    70     CleanupStack::PushL( self );
       
    71     self->ConstructL();
       
    72     CleanupStack::Pop( self );
       
    73     return self;    
       
    74     }
       
    75     
       
    76 // Destructor
       
    77 CSisxUI::~CSisxUI()
       
    78     {
       
    79     delete iWatcher;    
       
    80     
       
    81     if( iResourceFileOffset )
       
    82         {
       
    83         CEikonEnv::Static()->DeleteResourceFile( iResourceFileOffset );
       
    84         } 
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CSisxUI::InstallL
       
    89 // Perform installation.
       
    90 // (other items were commented in a header).
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 void CSisxUI::InstallL( RFile& aFile,
       
    94                         TInstallReq& aInstallParams, 
       
    95                         TBool aIsDRM, 
       
    96                         TRequestStatus& aStatus )
       
    97     {
       
    98     __ASSERT_ALWAYS( !iWatcher, User::Leave( KErrInUse ) );
       
    99     FLOG_2( _L("SisxUI: Install request with chrSet: %d, ap: %d"),       
       
   100             aInstallParams.iCharsetId, aInstallParams.iIAP );
       
   101     iWatcher = CSisxUIOperationWatcher::NewL();       
       
   102     iWatcher->InstallL( aFile, aInstallParams.iMIME, aIsDRM, aStatus );
       
   103     }
       
   104        
       
   105 // -----------------------------------------------------------------------------
       
   106 // CSisxUI::SilentInstallL
       
   107 // Perform silent installation.
       
   108 // (other items were commented in a header).
       
   109 // -----------------------------------------------------------------------------
       
   110 // 
       
   111 void CSisxUI::SilentInstallL( RFile& aFile,
       
   112                               TInstallReq& aInstallParams, 
       
   113                               TBool aIsDRM, 
       
   114                               TInstallOptions& aOptions,
       
   115                               TRequestStatus& aStatus )
       
   116     {
       
   117     __ASSERT_ALWAYS( !iWatcher, User::Leave( KErrInUse ) );
       
   118     FLOG_2( _L("SisxUI: SilentInstall request with chrSet: %d, ap: %d"),       
       
   119             aInstallParams.iCharsetId, aInstallParams.iIAP );
       
   120 
       
   121     iWatcher = CSisxUIOperationWatcher::NewL();       
       
   122     iWatcher->SilentInstallL( aFile, aInstallParams.iMIME, aIsDRM, aOptions, aStatus );
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CSisxUI::UninstallL
       
   127 // Perform uninstallation.
       
   128 // (other items were commented in a header).
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 void CSisxUI::UninstallL( const TUid& aUid, 
       
   132                           const TDesC8& /*aMIME*/,
       
   133                           TRequestStatus& aStatus )
       
   134     {
       
   135     __ASSERT_ALWAYS( !iWatcher, User::Leave( KErrInUse ) );
       
   136     FLOG_1( _L("SisxUI: Uninstall request with uid: %x"), aUid.iUid );    
       
   137 
       
   138     iWatcher = CSisxUIOperationWatcher::NewL();
       
   139     iWatcher->UninstallL( aUid, aStatus );
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CSisxUI::SilentUninstallL
       
   144 // Perform silent uninstallation.
       
   145 // (other items were commented in a header).
       
   146 // -----------------------------------------------------------------------------
       
   147 //    
       
   148 void CSisxUI::SilentUninstallL( const TUid& aUid, 
       
   149                                 const TDesC8& /*aMIME*/, 
       
   150                                 TUninstallOptions& aOptions,
       
   151                                 TRequestStatus& aStatus )
       
   152     {
       
   153     __ASSERT_ALWAYS( !iWatcher, User::Leave( KErrInUse ) );
       
   154     FLOG_1( _L("SisxUI: SilentUninstall request with uid: %x"), aUid.iUid );    
       
   155 
       
   156     iWatcher = CSisxUIOperationWatcher::NewL();
       
   157     iWatcher->SilentUninstallL( aUid, aOptions, aStatus );
       
   158     }
       
   159 
       
   160 // -----------------------------------------------------------------------------
       
   161 // CSisxUI::IsAppShellUpdate
       
   162 // Indicates if the application shell must be updated.
       
   163 // (other items were commented in a header).
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 TBool CSisxUI::IsAppShellUpdate()
       
   167     {
       
   168     return EFalse;
       
   169     }
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CSisxUI::CompleteL
       
   173 // Cancel the current operation.
       
   174 // (other items were commented in a header).
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 void CSisxUI::Cancel()
       
   178     {    
       
   179     if ( iWatcher )
       
   180         {
       
   181         iWatcher->Cancel();        
       
   182         } 
       
   183     }
       
   184 
       
   185 // -----------------------------------------------------------------------------
       
   186 // CSisxUI::CompleteL
       
   187 // Informs the plugin about completed operation. Called when all tasks are 
       
   188 // completed.
       
   189 // (other items were commented in a header).
       
   190 // -----------------------------------------------------------------------------
       
   191 //
       
   192 void CSisxUI::CompleteL()
       
   193     {
       
   194     if ( iWatcher )
       
   195         {
       
   196         iWatcher->FinalCompleteL();        
       
   197         }    
       
   198     }
       
   199         
       
   200 /**
       
   201 *
       
   202 */
       
   203 CErrDetails* CSisxUI::GetErrorDetails()
       
   204     {
       
   205     return NULL;    
       
   206     }
       
   207 
       
   208 // -----------------------------------------------------------------------------
       
   209 // CSisxUI::CustomUninstallL
       
   210 // Perform a custom uninstallation.
       
   211 // (other items were commented in a header).
       
   212 // -----------------------------------------------------------------------------
       
   213 //    
       
   214 void CSisxUI::CustomUninstallL( TOperation aOperation, 
       
   215                                 const TDesC8& aParams, 
       
   216                                 TRequestStatus& aStatus )
       
   217     {
       
   218     __ASSERT_ALWAYS( !iWatcher, User::Leave( KErrInUse ) );
       
   219 
       
   220     if ( aOperation == EOperationUninstallIndex )
       
   221         {
       
   222         // The client wants to uninstall a specific augmentation
       
   223 
       
   224         // We need to get uid and index from the parambuffer
       
   225         TOpUninstallIndexParam params;
       
   226         TPckg<TOpUninstallIndexParam> pckg( params );
       
   227         pckg.Copy( aParams );
       
   228 
       
   229         // Launch the uninstall
       
   230         iWatcher = CSisxUIOperationWatcher::NewL();
       
   231         iWatcher->UninstallAugmentationL( params.iUid, params.iIndex, aStatus );        
       
   232         }
       
   233     else
       
   234         {
       
   235         User::Leave( KErrNotSupported );
       
   236         }    
       
   237     }
       
   238 
       
   239 // -----------------------------------------------------------------------------
       
   240 // CSisxUI::SilentCustomUninstallL
       
   241 // Perform a silent custom uninstallation.
       
   242 // (other items were commented in a header).
       
   243 // -----------------------------------------------------------------------------
       
   244 //    
       
   245 void CSisxUI::SilentCustomUninstallL( TOperation aOperation, 
       
   246                                       TUninstallOptions& aOptions,
       
   247                                       const TDesC8& aParams, 
       
   248                                       TRequestStatus& aStatus )
       
   249     {
       
   250     __ASSERT_ALWAYS( !iWatcher, User::Leave( KErrInUse ) );
       
   251 
       
   252     if ( aOperation == EOperationUninstallIndex )
       
   253         {
       
   254         // The client wants to uninstall a specific augmentation
       
   255 
       
   256         // We need to get uid and index from the parambuffer
       
   257         TOpUninstallIndexParam params;
       
   258         TPckg<TOpUninstallIndexParam> pckg( params );
       
   259         pckg.Copy( aParams );
       
   260 
       
   261         // Launch the uninstall
       
   262         iWatcher = CSisxUIOperationWatcher::NewL();
       
   263         iWatcher->SilentUninstallAugmentationL( params.iUid, aOptions, params.iIndex, aStatus );        
       
   264         }
       
   265     else
       
   266         {
       
   267         User::Leave( KErrNotSupported );
       
   268         }    
       
   269     }
       
   270 
       
   271 //  End of File