Back to index

lightning-sunbird  0.9+nobinonly
nsMailWinIntegration.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; 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 Thunderbird Windows Integration.
00016  *
00017  * The Initial Developer of the Original Code is
00018  *   Scott MacGregor <mscott@mozilla.org>.
00019  * Portions created by the Initial Developer are Copyright (C) 2006
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 the GNU General Public License Version 2 or later (the "GPL"), or
00026  * 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 nsMailWinIntegration_h_
00039 #define nsMailWinIntegration_h_
00040 
00041 #include "nsIShellService.h"
00042 #include "nsIObserver.h"
00043 #include "nsIGenericFactory.h"
00044 #include "nsString.h"
00045 
00046 #include <ole2.h>
00047 #include <windows.h>
00048 
00049 #define NS_MAILWININTEGRATION_CID \
00050 {0x2ebbe84, 0xc179, 0x4598, {0xaf, 0x18, 0x1b, 0xf2, 0xc4, 0xbc, 0x1d, 0xf9}}
00051 
00052 typedef struct {
00053   char* keyName;
00054   char* valueName;
00055   char* valueData;
00056 
00057   PRInt32 flags;
00058 } SETTING;
00059 
00060 class nsWindowsShellService : public nsIShellService
00061 {
00062 public:
00063   nsWindowsShellService();
00064   virtual ~nsWindowsShellService() {};
00065   NS_HIDDEN_(nsresult) Init();
00066 
00067   NS_DECL_ISUPPORTS
00068   NS_DECL_NSISHELLSERVICE
00069 
00070 protected:
00071   void SetRegKey(const char* aKeyName, const char* aValueName, 
00072                  const char* aValue, PRBool aHKLMOnly);
00073   DWORD DeleteRegKey(HKEY baseKey, const char *keyName);
00074   DWORD DeleteRegKeyDefaultValue(HKEY baseKey, const char *keyName);
00075 
00076   PRBool TestForDefault(SETTING aSettings[], PRInt32 aSize);
00077   void setKeysForSettings(SETTING aSettings[], PRInt32 aSize, 
00078                           const char * aAppname);
00079   nsresult setDefaultMail();
00080   nsresult setDefaultNews();
00081 
00082   PRBool IsDefaultClientVista(PRBool aStartupCheck, PRUint16 aApps, PRBool* aIsDefaultClient);
00083   PRBool SetDefaultClientVista(PRUint16 aApps);
00084 
00085 private:
00086   PRBool mCheckedThisSession;
00087   nsCString mAppLongPath;
00088   nsCString mAppShortPath;
00089   nsCString mMapiDLLPath;
00090   nsCString mUninstallPath;
00091   nsXPIDLString mBrandFullName;
00092   nsXPIDLString mBrandShortName;
00093  };
00094 
00095 #endif