Back to index

lightning-sunbird  0.9+nobinonly
nsInstallFileOpItem.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nsInstallFileOpItem_h__
00039 #define nsInstallFileOpItem_h__
00040 
00041 #include "prtypes.h"
00042 
00043 #include "nsIFile.h"
00044 #include "nsSoftwareUpdate.h"
00045 #include "nsInstallObject.h"
00046 #include "nsInstall.h"
00047 
00048 class nsInstallFileOpItem : public nsInstallObject
00049 {
00050   public:
00051     /* Public Fields */
00052     enum 
00053     {
00054       ACTION_NONE                 = -401,
00055       ACTION_SUCCESS              = -402,
00056       ACTION_FAILED               = -403
00057     };
00058 
00059 
00060     /* Public Methods */
00061     // used by:
00062     //   FileOpFileDelete()
00063     nsInstallFileOpItem(nsInstall*    installObj,
00064                         PRInt32       aCommand,
00065                         nsIFile*      aTarget,
00066                         PRInt32       aFlags,
00067                         PRInt32*      aReturn);
00068 
00069     // used by:
00070     //   FileOpDirRemove()
00071     //   FileOpFileCopy()
00072     //   FileOpFileMove()
00073     //   FileMacAlias()
00074     nsInstallFileOpItem(nsInstall*    installObj,
00075                         PRInt32       aCommand,
00076                         nsIFile*      aSrc,
00077                         nsIFile*      aTarget,
00078                         PRInt32*      aReturn);
00079 
00080     // used by:
00081     //   FileOpDirCreate()
00082     nsInstallFileOpItem(nsInstall*    aInstallObj,
00083                         PRInt32       aCommand,
00084                         nsIFile*      aTarget,
00085                         PRInt32*      aReturn);
00086 
00087     // used by:
00088     //   FileOpDirRename()
00089     //   FileOpFileExecute()
00090     //   FileOpFileRename()
00091     nsInstallFileOpItem(nsInstall*    aInstallObj,
00092                         PRInt32       aCommand,
00093                         nsIFile*      a1,
00094                         nsString&     a2,
00095                         PRBool        aBlocking,
00096                         PRInt32*      aReturn);
00097 
00098     // used by:
00099     //   WindowsShortcut()
00100     nsInstallFileOpItem(nsInstall*    aInstallObj,
00101                         PRInt32       aCommand,
00102                         nsIFile*      aTarget,
00103                         nsIFile*      aShortcutPath,
00104                         nsString&     aDescription,
00105                         nsIFile*      aWorkingPath,
00106                         nsString&     aParams,
00107                         nsIFile*      aIcon,
00108                         PRInt32       aIconId,
00109                         PRInt32*      aReturn);
00110 
00111     virtual ~nsInstallFileOpItem();
00112 
00113     PRInt32       Prepare(void);
00114     PRInt32       Complete();
00115     char*         toString();
00116     void          Abort();
00117     
00118   /* should these be protected? */
00119     PRBool        CanUninstall();
00120     PRBool        RegisterPackageNode();
00121       
00122   private:
00123     
00124     /* Private Fields */
00125     
00126     nsInstall*          mIObj;        // initiating Install object
00127     nsCOMPtr<nsIFile>   mSrc;
00128     nsCOMPtr<nsIFile>   mTarget;
00129     nsCOMPtr<nsIFile>   mShortcutPath;
00130     nsCOMPtr<nsIFile>   mWorkingPath;
00131     nsCOMPtr<nsIFile>   mIcon;
00132     nsString            mDescription;
00133     nsString*           mStrTarget;
00134     nsString            mParams;
00135     long                mFStat;
00136     PRInt32             mFlags;
00137     PRInt32             mIconId;
00138     PRInt32             mCommand;
00139     PRInt32             mAction;
00140     PRBool              mBlocking;
00141     
00142     /* Private Methods */
00143 
00144     PRInt32       NativeFileOpDirCreatePrepare();
00145     PRInt32       NativeFileOpDirCreateAbort();
00146     PRInt32       NativeFileOpDirRemovePrepare();
00147     PRInt32       NativeFileOpDirRemoveComplete();
00148     PRInt32       NativeFileOpDirRenamePrepare();
00149     PRInt32       NativeFileOpDirRenameComplete();
00150     PRInt32       NativeFileOpDirRenameAbort();
00151     PRInt32       NativeFileOpFileCopyPrepare();
00152     PRInt32       NativeFileOpFileCopyComplete();
00153     PRInt32       NativeFileOpFileCopyAbort();
00154     PRInt32       NativeFileOpFileDeletePrepare();
00155     PRInt32       NativeFileOpFileDeleteComplete(nsIFile *aTarget);
00156     PRInt32       NativeFileOpFileExecutePrepare();
00157     PRInt32       NativeFileOpFileExecuteComplete();
00158     PRInt32       NativeFileOpFileMovePrepare();
00159     PRInt32       NativeFileOpFileMoveComplete();
00160     PRInt32       NativeFileOpFileMoveAbort();
00161     PRInt32       NativeFileOpFileRenamePrepare();
00162     PRInt32       NativeFileOpFileRenameComplete();
00163     PRInt32       NativeFileOpFileRenameAbort();
00164     PRInt32       NativeFileOpWindowsShortcutPrepare();
00165     PRInt32       NativeFileOpWindowsShortcutComplete();
00166     PRInt32       NativeFileOpWindowsShortcutAbort();
00167     PRInt32       NativeFileOpMacAliasPrepare();
00168     PRInt32       NativeFileOpMacAliasComplete();
00169     PRInt32       NativeFileOpMacAliasAbort();
00170     PRInt32       NativeFileOpUnixLink();
00171     PRInt32       NativeFileOpWindowsRegisterServerPrepare();
00172     PRInt32       NativeFileOpWindowsRegisterServerComplete();
00173     PRInt32       NativeFileOpWindowsRegisterServerAbort();
00174 
00175 };
00176 
00177 #endif /* nsInstallFileOpItem_h__ */
00178