diff --git a/mozilla/modules/plugin/samples/default/os2/plugin.cpp b/mozilla/modules/plugin/samples/default/os2/plugin.cpp index 155c745c7e4..45a3a29d87a 100644 --- a/mozilla/modules/plugin/samples/default/os2/plugin.cpp +++ b/mozilla/modules/plugin/samples/default/os2/plugin.cpp @@ -227,7 +227,7 @@ BOOL CPlugin::init(HWND hWndParent) WinShowWindow(m_hWnd, TRUE); } -// if(IsNewMimeType((PSZ)m_pNPMIMEType) || m_bHidden) + if(IsNewMimeType((PSZ)m_pNPMIMEType) || m_bHidden) showGetPluginDialog(); return TRUE; diff --git a/mozilla/modules/plugin/samples/default/os2/plugin.h b/mozilla/modules/plugin/samples/default/os2/plugin.h index db037a24a3d..5a4cf32306d 100644 --- a/mozilla/modules/plugin/samples/default/os2/plugin.h +++ b/mozilla/modules/plugin/samples/default/os2/plugin.h @@ -111,14 +111,11 @@ public: #define DEFAULT_PLUGINFINDER_URL "http://plugins.netscape.com/plug-in_finder.adp" #define JVM_SMARTUPDATE_URL "http://home.netscape.com/plugins/jvm.html" -#ifdef WIN32 -#define REGISTRY_PLACE "Software\\Netscape\\Netscape Navigator\\Default Plugin" -#else +#define OS2INI_PLACE "Mozilla Default Plugin" #define GWL_USERDATA 0 #define COLOR_3DSHADOW COLOR_BTNFACE #define COLOR_3DLIGHT COLOR_BTNHIGHLIGHT #define COLOR_3DDKSHADOW COLOR_BTNSHADOW -#endif #define CLASS_NULL_PLUGIN "NullPluginClass" diff --git a/mozilla/modules/plugin/samples/default/os2/utils.cpp b/mozilla/modules/plugin/samples/default/os2/utils.cpp index 069939577eb..daf0f7f5ace 100644 --- a/mozilla/modules/plugin/samples/default/os2/utils.cpp +++ b/mozilla/modules/plugin/samples/default/os2/utils.cpp @@ -36,44 +36,29 @@ * ***** END LICENSE BLOCK ***** */ #define INCL_GPI +#define INCL_WIN #include #include #include "plugin.h" -#ifdef OLDCODE -// open the registry, create if necessary -HKEY openRegistry() -{ - HKEY phkResult; - - if(RegCreateKey(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS) - MessageBox(0, "Error creating Default Plugin registry key", "Default Plugin", MB_OK); - - return phkResult; -} - // return TRUE if we've never seen this MIME type before BOOL IsNewMimeType(PSZ mime) { - HKEY hkey = openRegistry(); - DWORD dwType, keysize = 512; + ULONG keysize = 512; char keybuf[512]; - if(RegQueryValueEx(hkey, mime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS) - { - // key exists, must have already been here... + PrfQueryProfileString(HINI_USERPROFILE, OS2INI_PLACE, mime, "", keybuf, keysize); + if (keybuf[0] != '\0') { return FALSE; } else { - if(RegSetValueEx(hkey, mime, 0, REG_SZ, (LPBYTE) "(none)", 7) != ERROR_SUCCESS) - MessageBox(0, "Error adding MIME type value", "Default Plugin", MB_OK); - + if (!(PrfWriteProfileString(HINI_USERPROFILE, OS2INI_PLACE, mime, "(none)"))) + WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "Error adding MIME type value", "Default Plugin", 0, MB_OK); return TRUE; } } -#endif // string length in pixels for the specific window (selected font) static int getWindowStringLength(HWND hWnd, PSZ lpsz) diff --git a/mozilla/modules/plugin/samples/default/os2/utils.h b/mozilla/modules/plugin/samples/default/os2/utils.h index 949c90e364e..d7fe2b0706d 100644 --- a/mozilla/modules/plugin/samples/default/os2/utils.h +++ b/mozilla/modules/plugin/samples/default/os2/utils.h @@ -38,10 +38,7 @@ #ifndef __UTILS_H__ #define __UTILS_H__ -#ifdef OLDCODE -HKEY openRegistry(); BOOL IsNewMimeType(PSZ szMimeType); -#endif void SetDlgItemTextWrapped(HWND hWnd, int iID, PSZ szText); #endif // __UTILS_H__