javamanager/javasettings/appmngrplugin/inc/appmngr2midletpackageinfo.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 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:  MIDlet suite Package Info represents installable JAR/JAD files
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef APPMNGR2MIDLETPACKAGEINFO_H
       
    20 #define APPMNGR2MIDLETPACKAGEINFO_H
       
    21 
       
    22 #include <appmngr2packageinfo.h>        // CAppMngr2PackageInfo
       
    23 #include <SWInstApi.h>                  // SwiUI::RSWInstLauncher
       
    24 #include <downloadedcontenthandler.h>   // MDownloadedContentHandler
       
    25 #include "appmngr2midletinfo.h"         // MAppMngr2MidletInfo
       
    26 
       
    27 class CAppMngr2MidletInfoIterator;
       
    28 class CAppMngr2MidletResourceHandler;
       
    29 
       
    30 void CleanUpResetAndDestroy(TAny *aArray);
       
    31 
       
    32 /**
       
    33  * MIDlet Suite Installation Package Info
       
    34  *
       
    35  * MIDlet Suite Installation Package Info represents installable
       
    36  * MIDlet suite packages (JAD/JAR files).
       
    37  * It handles installation, removal, sending and shows details of
       
    38  * installable JAD/JAR files.
       
    39  *
       
    40  * @lib appmngr2midletplugin.dll
       
    41  * @since S60 v9.1
       
    42  */
       
    43 class CAppMngr2MidletPackageInfo : public CAppMngr2PackageInfo,
       
    44         public MAppMngr2MidletInfo,
       
    45         public MDownloadedContentHandler
       
    46 {
       
    47 public:     // constructor and destructor
       
    48 
       
    49     /**
       
    50      * Two phase constructor
       
    51      *
       
    52      * @since S60 9.1
       
    53      * @return instance
       
    54      * @param aRuntime Runtime
       
    55      * @param aJadFileName MIDlet suite JAD file name, KNullDesC if not available
       
    56      * @param aJarFileName MIDlet suite JAR file name, KNullDesC if not available
       
    57      * @param aFs Handle to a file server session
       
    58      */
       
    59     static CAppMngr2MidletPackageInfo* NewL(
       
    60         CAppMngr2Runtime& aRuntime,
       
    61         const TDesC& aJadFileName,
       
    62         const TDesC& aJarFileName,
       
    63         RFs& aFs,
       
    64         CAppMngr2MidletResourceHandler& aResourceHandler);
       
    65 
       
    66     /**
       
    67      * Two phase constructor
       
    68      *
       
    69      * @since S60 9.1
       
    70      * @return instance
       
    71      * @param aRuntime Runtime
       
    72      * @param aJadFileName MIDlet suite JAD file name, KNullDesC if not available
       
    73      * @param aJarFileName MIDlet suite JAR file name, KNullDesC if not available
       
    74      * @param aFs Handle to a file server session
       
    75      */
       
    76     static CAppMngr2MidletPackageInfo* NewLC(
       
    77         CAppMngr2Runtime& aRuntime,
       
    78         const TDesC& aJadFileName,
       
    79         const TDesC& aJarFileName,
       
    80         RFs& aFs,
       
    81         CAppMngr2MidletResourceHandler& aResourceHandler);
       
    82 
       
    83     /**
       
    84      * Destructor
       
    85      *
       
    86      * @since S60 9.1
       
    87      */
       
    88     ~CAppMngr2MidletPackageInfo();
       
    89 
       
    90 public:     // from CAppMngr2InfoBase
       
    91 
       
    92     /**
       
    93      * Icon index for the installed application or installation package.
       
    94      * Returns icon index referring to the icon array loaded in function
       
    95      * CAppMngr2Runtime::LoadIconsL(). If an item has a specific icon that
       
    96      * no other items use, return EAppMngr2UseSpecificIcon and load the
       
    97      * specific icon via CAppMngr2InfoBase::SpecificIconL().
       
    98      * @return TInt  Index to the icon array
       
    99      */
       
   100     TInt IconIndex() const;
       
   101 
       
   102     /**
       
   103      * Name of the list item, first line
       
   104      * @return const TDesC&  Displayable name
       
   105      */
       
   106     const TDesC& Name() const;
       
   107 
       
   108     /**
       
   109      * Additional info, second line (usually size)
       
   110      * @returns const TDesC&  Displayable additional information line
       
   111      */
       
   112     const TDesC& Details() const;
       
   113 
       
   114     /**
       
   115      * Indicator icon index. Returns indexes to the icon array returned by
       
   116      * CAppMngr2Runtime::LoadIconsL(). Also default icon indexes defined in
       
   117      * AppMngr2Common.hrh (TAppMngr2IconIndex) can be used. Return
       
   118      * EAppMngr2NoIndicatorIcon if no indicator icon should be displayed, or
       
   119      * EAppMngr2UseSpecificIcon if item specific indicator icon is returned
       
   120      * via CAppMngr2InfoBase::SpecificIndicatorIconL().
       
   121      * @return TInt  Index to the icon array, or default icon number
       
   122      */
       
   123     TInt IndicatorIconIndex() const;
       
   124 
       
   125     /**
       
   126      * Defines item specific menu items.
       
   127      * Empty default implementation is used, if plug-in does not override it.
       
   128      * Menu commands are run via CAppMngr2InfoBase::HandleCommandL()
       
   129      * @param aMenuCmds Array where plug-in specific menu items are added
       
   130      */
       
   131     void GetMenuItemsL(RPointerArray<CEikMenuPaneItem::SData>& aMenuCmds);
       
   132 
       
   133     /**
       
   134      * Can be used to enable generic menu commands. Generic menu commands are
       
   135      * defined in TAppMngr2GenericCommands enum in AppMngr2Common.hrh. Generic
       
   136      * commands are hidden from the menu if the currently selected item does not
       
   137      * support them. Return ETrue for those command ids that are supported by
       
   138      * this item.
       
   139      * @param aCmdId Generic command id
       
   140      * @return TBool ETrue if command aCmdId is supported
       
   141      */
       
   142     TBool SupportsGenericCommand(TInt aCmdId);
       
   143 
       
   144     /**
       
   145      * Starts user invoked commands asynchronously. Command id may be a generic
       
   146      * command id or a plug-in specific command id. Generic command ids are defined
       
   147      * inAppMngr2Common.hrh (see TAppMngr2GenericCommand enum). Plug-in specific
       
   148      * commands are defined via functions CAppMngr2InfoBase::GetMenuItemsL() and
       
   149      * CAppMngr2InfoBase::GetMiddleSoftkeyCommandL(). If the command is synchronous,
       
   150      * the plug-in must complete the aStatus by calling User::RequestComplete().
       
   151      * @param aCommandId  Command id to be run
       
   152      * @param aStatus  Active object request status
       
   153      */
       
   154     void HandleCommandL(TInt aCommandId, TRequestStatus& aStatus);
       
   155 
       
   156     /**
       
   157      * If CAppMngr2InfoBase::HandleCommandResultL() started an asynchronous operation,
       
   158      * this function is called when the operation completes.
       
   159      * @param aStatus  Completion code, KErrNone or some error code
       
   160      */
       
   161     void HandleCommandResultL(TInt aStatus);
       
   162 
       
   163     /**
       
   164      * Cancels asynchronously started HandleCommandL() command. This function
       
   165      * may be called any time when an asynchronous command is running and it
       
   166      * must cancel the running command as quickly as possible.
       
   167      */
       
   168     void CancelCommand();
       
   169 
       
   170 public:      // from MDownloadContentHandler for browser integration
       
   171     /**
       
   172      * Handle downloaded content that has been saved to a file,
       
   173      * and return ETrue if it was handled successfully.
       
   174      *
       
   175      * @since S60 9.1
       
   176      * @param aFileName File name with path.
       
   177      * @param aParamList Generic parameter list.
       
   178      * @param aContinue Output parameter: It must be ETrue if the caller wants
       
   179      *                  Browser not to terminate after the content is handled.
       
   180      * @return ETrue if the implementer has processed the content. If it is
       
   181      *                  EFalse, BrowserLauncher opens that content in an
       
   182      *                  appropriate viewer application.
       
   183      */
       
   184     TBool HandleContentL(const TDesC& aFileName,
       
   185                          const CAiwGenericParamList& aParamList,
       
   186                          TBool& aContinue);
       
   187 
       
   188     /**
       
   189      * From MDownloadContentHandler for browser integration
       
   190      * @since S60 9.1
       
   191      * reserved for future use
       
   192      */
       
   193     TAny* DownloadedContentHandlerReserved1(TAny* /*aAnyParam*/);
       
   194 
       
   195 public:     // from MAppMngr2MidletInfo
       
   196     /**
       
   197      * Path to jad file
       
   198      *
       
   199      * @since S60 9.1
       
   200      * @return Path to jad file, return KNullDesC if not available
       
   201      */
       
   202     const TDesC& JadFileName() const;
       
   203 
       
   204     /**
       
   205      * Path to jar file
       
   206      *
       
   207      * @since S60 9.1
       
   208      * @return Path to jar file, return KNullDesC if not available
       
   209      */
       
   210     const TDesC& JarFileName() const;
       
   211 
       
   212     /**
       
   213      * Package MIME type
       
   214      *
       
   215      * @since S60 9.1
       
   216      * @return Package MIME type
       
   217      */
       
   218     const TDesC8& MimeType() const;
       
   219 
       
   220 public:     // new functions
       
   221     /**
       
   222      * Path to package file (Jar if no Jad file, else Jad)
       
   223      *
       
   224      * @since S60 9.1
       
   225      * @return path to package file
       
   226      */
       
   227     const TDesC& FileName() const;
       
   228 
       
   229     /**
       
   230      * Return true if package is DRM protected
       
   231      *
       
   232      * @since S60 9.1
       
   233      * @return package is DRM protected
       
   234      */
       
   235     TBool IsDRMProtected() const;
       
   236 
       
   237     /**
       
   238      * DRM protected package file path
       
   239      *
       
   240      * @since S60 9.1
       
   241      * @return Path to protected package if available, else return KNullDesC
       
   242      */
       
   243     const TDesC& ProtectedFileName() const;
       
   244 
       
   245 
       
   246 private:    // new functions
       
   247 
       
   248     /**
       
   249      * Constructor
       
   250      *
       
   251      * @since S60 9.1
       
   252      * @param aRuntime Runtime
       
   253      * @param aFs Handle to a file server session
       
   254      */
       
   255     CAppMngr2MidletPackageInfo(CAppMngr2Runtime& aRuntime, RFs& aFs, CAppMngr2MidletResourceHandler& aResourceHandler);
       
   256 
       
   257     /**
       
   258      * Second phase constructor
       
   259      *
       
   260      * @since S60 9.1
       
   261      * @param aJadFileName MIDlet suite JAD file name, KNullDesC if not available
       
   262      * @param aJarFileName MIDlet suite JAR file name, KNullDesC if not available
       
   263      */
       
   264     void ConstructL(const TDesC& aJadFileName, const TDesC& aJarFileName);
       
   265 
       
   266     /**
       
   267      * Removes MIDlet suite installation package
       
   268      *
       
   269      * @since S60 9.1
       
   270      */
       
   271     void RemoveL();
       
   272 
       
   273     /**
       
   274      * Installs MIDlet suite installation package
       
   275      *
       
   276      * @since S60 9.1
       
   277      * @param aStatus The request status. KErrNone on completion,
       
   278      *                otherwise another of the system-wide error codes.
       
   279      */
       
   280     void InstallL(TRequestStatus& aStatus);
       
   281 
       
   282     /**
       
   283      * Cancel MIDlet suite installation package installation
       
   284      *
       
   285      * @since S60 9.1
       
   286      */
       
   287     void CancelInstallationL();
       
   288 
       
   289     /**
       
   290      * Show MIDlet suite installation package details
       
   291      *
       
   292      * @since S60 9.1
       
   293      */
       
   294     void ShowDetailsL();
       
   295 
       
   296     /**
       
   297      * Send MIDlet suite installation package
       
   298      *
       
   299      * @since S60 9.1
       
   300      */
       
   301     void SendL();
       
   302 
       
   303     /**
       
   304      * Starts the browser with midlet's MIDLET-Info-URL parameter
       
   305      *
       
   306      * @since S60 9.1
       
   307      * @param aStatus The request status. KErrNone on completion,
       
   308      *                otherwise another of the system-wide error codes.
       
   309      */
       
   310     void ShowInfoUrlL();
       
   311 
       
   312     /**
       
   313      * Return Info Iterator which implements MCUIInfoIterator API for
       
   314      * CCUIDetailsDialog
       
   315      *
       
   316      * @since S60 9.1
       
   317      * @return Info iterator object
       
   318      */
       
   319     CAppMngr2MidletInfoIterator& InfoIteratorL();
       
   320 
       
   321 private:    // data
       
   322 
       
   323     /**
       
   324      * MIDlet suite is DRM protected
       
   325      */
       
   326     TBool iIsDRMProtected;
       
   327 
       
   328     /**
       
   329      * MIDlet suite name
       
   330      * Owned
       
   331      */
       
   332     HBufC* iName;
       
   333 
       
   334     /**
       
   335      * MIDlet suite details
       
   336      * Owned
       
   337      */
       
   338     HBufC* iDetails;
       
   339 
       
   340     /**
       
   341      * MIDlet suite file name (jad or jar)
       
   342      * Owned
       
   343      */
       
   344     HBufC* iFileName;
       
   345 
       
   346     /**
       
   347      * MIDlet suite JAD file name
       
   348      * Owned
       
   349      */
       
   350     HBufC* iJadFileName;
       
   351 
       
   352     /**
       
   353      * MIDlet suite JAR
       
   354      * Owned
       
   355      */
       
   356     HBufC* iJarFileName;
       
   357 
       
   358     /**
       
   359      * MIDlet suite MIME type
       
   360      * Owned
       
   361      */
       
   362     HBufC8* iMimeType;
       
   363 
       
   364     /**
       
   365      * Installer launcher
       
   366      * Owned
       
   367      */
       
   368     SwiUI::RSWInstLauncher* iSWInstLauncher;
       
   369 
       
   370     /**
       
   371      * Info iterator
       
   372      * Owned
       
   373      */
       
   374     CAppMngr2MidletInfoIterator* iInfoIterator;
       
   375 
       
   376     CAppMngr2MidletResourceHandler& iResourceHandler;
       
   377 };
       
   378 
       
   379 #endif // APPMNGR2MIDLETPACKAGEINFO_H
       
   380