javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java
branchRCL_3
changeset 17 0fd27995241b
parent 14 04becd199f91
child 24 6c158198356e
equal deleted inserted replaced
15:f9bb0fca356a 17:0fd27995241b
    46     private int iOperation = 0;
    46     private int iOperation = 0;
    47     /** Global component id for the application. */
    47     /** Global component id for the application. */
    48     private String iGlobalComponentId = null;
    48     private String iGlobalComponentId = null;
    49     /** Component name (i.e. suite name). */
    49     /** Component name (i.e. suite name). */
    50     private String iComponentName = null;
    50     private String iComponentName = null;
    51     /** Array of pplication names. */
    51     /** Application names. */
    52     private String[] iApplicationNames = null;
    52     private String[] iApplicationNames = null;
       
    53     /** Applications icons. */
       
    54     private String[] iApplicationIcons = null;
    53     /** Component initial size. */
    55     /** Component initial size. */
    54     private int iComponentSize = 0;
    56     private int iComponentSize = 0;
    55     /** Component icon path. */
    57     /** Icon dir. */
    56     private String iComponentIconPath = null;
    58     private String iIconDir = null;
       
    59     /** Component icon. */
       
    60     private String iComponentIcon = null;
       
    61 
       
    62     /** Sending progress notifications is only allowed between start
       
    63      *  and end notifications. */
       
    64     private boolean iNotifyProgressAllowed = false;
    57 
    65 
    58     /** Native object handle. */
    66     /** Native object handle. */
    59     private int iHandle = 0;
    67     private int iHandle = 0;
    60 
    68 
    61     /*** ----------------------------- PUBLIC ------------------------------ */
    69     /*** ----------------------------- PUBLIC ------------------------------ */
    81      *
    89      *
    82      * @throws InstallerException in case an error occurs
    90      * @throws InstallerException in case an error occurs
    83      */
    91      */
    84     public void notifyStart(
    92     public void notifyStart(
    85         int aOperation, String aGlobalComponentId, String aComponentName,
    93         int aOperation, String aGlobalComponentId, String aComponentName,
    86         String[] aApplicationNames, int aComponentSize,
    94         String[] aApplicationNames, String[] aApplicationIcons,
    87         String aComponentIconPath)
    95         int aComponentSize, String aIconDir, String aComponentIcon)
    88     {
    96     {
    89         iOperation = aOperation;
    97         iOperation = aOperation;
    90         iGlobalComponentId = aGlobalComponentId;
    98         iGlobalComponentId = aGlobalComponentId;
    91         iComponentName = aComponentName;
    99         iComponentName = aComponentName;
    92         iApplicationNames = aApplicationNames;
   100         iApplicationNames = aApplicationNames;
       
   101         iApplicationIcons = aApplicationIcons;
    93         iComponentSize = aComponentSize;
   102         iComponentSize = aComponentSize;
    94         iComponentIconPath = aComponentIconPath;
   103         iIconDir = aIconDir;
       
   104         iComponentIcon = aComponentIcon;
    95 
   105 
    96         if (iHandle == 0)
   106         if (iHandle == 0)
    97         {
   107         {
    98             InstallerException.internalError(
   108             InstallerException.internalError(
    99                 "SifNotifier.notifyStart: notifier has not been initialized");
   109                 "SifNotifier.notifyStart: notifier has not been initialized");
   100         }
   110         }
   101         int ret = _notifyStart(
   111         int ret = _notifyStart(
   102                       iHandle, aGlobalComponentId, aComponentName, aApplicationNames,
   112                       iHandle, aGlobalComponentId, aComponentName,
   103                       aComponentSize, aComponentIconPath);
   113                       aApplicationNames, aApplicationIcons,
       
   114                       aComponentSize, aIconDir, aComponentIcon);
   104         if (ret < 0)
   115         if (ret < 0)
   105         {
   116         {
   106             Log.logError("Notifying SIF start failed with code " + ret +
   117             Log.logError("Notifying SIF start failed with code " + ret +
   107                          ", " + getInfoString());
   118                          ", " + getInfoString());
   108             InstallerException.internalError(
   119             InstallerException.internalError(
   109                 "Notifying SIF start failed with code " + ret);
   120                 "Notifying SIF start failed with code " + ret);
   110         }
   121         }
       
   122         iNotifyProgressAllowed = true;
   111     }
   123     }
   112 
   124 
   113     /**
   125     /**
   114      * Notifies SIF that installation or uinstallation has ended.
   126      * Notifies SIF that installation or uinstallation has ended.
   115      *
   127      *
   121         if (iHandle == 0)
   133         if (iHandle == 0)
   122         {
   134         {
   123             InstallerException.internalError(
   135             InstallerException.internalError(
   124                 "SifNotifier.notifyEnd: notifier has not been initialized");
   136                 "SifNotifier.notifyEnd: notifier has not been initialized");
   125         }
   137         }
       
   138         iNotifyProgressAllowed = false;
   126         int ret = _notifyEnd(
   139         int ret = _notifyEnd(
   127                       iHandle, iGlobalComponentId, aErrCategory, aErrCode,
   140                       iHandle, iGlobalComponentId, aErrCategory, aErrCode,
   128                       aErrMsg, aErrMsgDetails);
   141                       aErrMsg, aErrMsgDetails);
   129         if (ret < 0)
   142         if (ret < 0)
   130         {
   143         {
   144      *
   157      *
   145      * @throws InstallerException in case an error occurs
   158      * @throws InstallerException in case an error occurs
   146      */
   159      */
   147     public void notifyProgress(int aSubOperation, int aCurrent, int aTotal)
   160     public void notifyProgress(int aSubOperation, int aCurrent, int aTotal)
   148     {
   161     {
       
   162         if (!iNotifyProgressAllowed)
       
   163         {
       
   164             return;
       
   165         }
   149         if (iHandle == 0)
   166         if (iHandle == 0)
   150         {
   167         {
   151             InstallerException.internalError(
   168             InstallerException.internalError(
   152                 "SifNotifier.notifyProgress: notifier has not been initialized");
   169                 "SifNotifier.notifyProgress: notifier has not been initialized");
   153         }
   170         }
   238      *
   255      *
   239      * @param aHandle
   256      * @param aHandle
   240      * @param aGlobalComponentId
   257      * @param aGlobalComponentId
   241      * @param aComponentName
   258      * @param aComponentName
   242      * @param aApplicationNames
   259      * @param aApplicationNames
       
   260      * @param aApplicationIcons
   243      * @param aComponentSize
   261      * @param aComponentSize
   244      * @param aComponentIconPath
   262      * @param aIconDir
       
   263      * @param aComponentIcon
   245      * @return Symbian error code (negative number) if operation fails,
   264      * @return Symbian error code (negative number) if operation fails,
   246      * otherwise 0
   265      * otherwise 0
   247      */
   266      */
   248     private static native int _notifyStart(
   267     private static native int _notifyStart(
   249         int aHandle, String aGlobalComponentId, String aComponentName,
   268         int aHandle, String aGlobalComponentId, String aComponentName,
   250         String[] aApplicationNames, int aComponentSize,
   269         String[] aApplicationNames, String[] aApplicationIcons,
   251         String aComponentIconPath);
   270         int aComponentSize, String aIconDir, String aComponentIcon);
   252 
   271 
   253     /**
   272     /**
   254      * Notifies SIF about installation/uinstallation completion.
   273      * Notifies SIF about installation/uinstallation completion.
   255      *
   274      *
   256      * @param aHandle
   275      * @param aHandle