зеркало из https://github.com/mozilla/pjs.git
Completing work on Win98 integration feature
This commit is contained in:
Родитель
081a25e0c8
Коммит
d6fea3ea2d
|
@ -23,6 +23,9 @@
|
|||
#include "helper.h"
|
||||
#include "nethelp.h"
|
||||
|
||||
#include "nsIDefaultBrowser.h"
|
||||
#include "prefapi.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char BASED_CODE THIS_FILE[] = __FILE__;
|
||||
|
@ -775,15 +778,35 @@ END_MESSAGE_MAP()
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
CDefaultBrowserDlg::CDefaultBrowserDlg(CWnd* pParent /*=NULL*/)
|
||||
CDefaultBrowserDlg::CDefaultBrowserDlg(CWnd* pParent /*=NULL*/, nsIDefaultBrowser* pDefaultBrowser /*=NULL*/)
|
||||
: CDefaultBrowserDlgBase(CDefaultBrowserDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CDefaultBrowserDlg)
|
||||
m_bIgnore = FALSE;
|
||||
m_bPerformCheck = TRUE; // If false, we wouldn't be here, now would we?
|
||||
m_pDefaultBrowser = pDefaultBrowser;
|
||||
if ( m_pDefaultBrowser ) {
|
||||
m_pDefaultBrowser->AddRef();
|
||||
}
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
} // END OF FUNCTION CDefaultBrowserDlg::CDefaultBrowserDlg()
|
||||
|
||||
CDefaultBrowserDlg::CDefaultBrowserDlg(nsIDefaultBrowser* pDefaultBrowser)
|
||||
: CDefaultBrowserDlgBase(CDefaultBrowserDlg::IDD, NULL)
|
||||
{
|
||||
m_bPerformCheck = TRUE; // If false, we wouldn't be here, now would we?
|
||||
m_pDefaultBrowser = pDefaultBrowser;
|
||||
if ( m_pDefaultBrowser ) {
|
||||
m_pDefaultBrowser->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
CDefaultBrowserDlg::~CDefaultBrowserDlg() {
|
||||
if ( m_pDefaultBrowser ) {
|
||||
m_pDefaultBrowser->Release();
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* CDefaultBrowserDlg::DoDataExchange
|
||||
|
@ -804,7 +827,7 @@ void CDefaultBrowserDlg::DoDataExchange(CDataExchange* pDX)
|
|||
CDefaultBrowserDlgBase::DoDataExchange(pDX);
|
||||
|
||||
//{{AFX_DATA_MAP(CDefaultBrowserDlg)
|
||||
DDX_Check(pDX, IDC_IGNORE, m_bIgnore);
|
||||
DDX_Check(pDX, IDC_IGNORE, m_bPerformCheck);
|
||||
DDX_Control(pDX, IDC_LIST1, m_Listbox);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
|
@ -831,6 +854,12 @@ void CDefaultBrowserDlg::OnNo()
|
|||
if (UpdateData(TRUE))
|
||||
{
|
||||
EndDialog(ID_NO);
|
||||
|
||||
// Update "perform check" preference per check-box setting.
|
||||
if ( !m_bPerformCheck ) {
|
||||
PREF_SetBoolPref("browser.wfe.ignore_def_check",TRUE);
|
||||
}
|
||||
|
||||
} /* end if */
|
||||
|
||||
} // END OF FUNCTION CDefaultBrowserDlg::OnNo()
|
||||
|
@ -856,6 +885,7 @@ void CDefaultBrowserDlg::OnDetails()
|
|||
if (UpdateData(TRUE))
|
||||
{
|
||||
EndDialog(IDC_SHOW_DESKTOP_PREFS);
|
||||
|
||||
} /* end if */
|
||||
|
||||
} // END OF FUNCTION CDefaultBrowserDlg::OnDetails()
|
||||
|
@ -937,6 +967,21 @@ static BOOL IsListItemSelected(int* selArray, int count, int i)
|
|||
|
||||
void CDefaultBrowserDlg::OnOK()
|
||||
{
|
||||
// Dismiss the dialog.
|
||||
CDefaultBrowserDlgBase::OnOK();
|
||||
|
||||
// Update "perform check" preference per check-box setting.
|
||||
if ( !m_bPerformCheck ) {
|
||||
PREF_SetBoolPref("browser.wfe.ignore_def_check",TRUE);
|
||||
}
|
||||
|
||||
if ( m_pDefaultBrowser ) {
|
||||
// synchronize registry with these preferences.
|
||||
nsresult result = m_pDefaultBrowser->HandlePerPreferences();
|
||||
ASSERT( result == NS_OK );
|
||||
}
|
||||
|
||||
#if 0 // Old code.
|
||||
// Let's do it. Selected items become owned.
|
||||
// Unselected items become ignored (if the checkbox is checked)
|
||||
CDefaultBrowserDlgBase::OnOK();
|
||||
|
@ -968,6 +1013,7 @@ void CDefaultBrowserDlg::OnOK()
|
|||
theItem->SetIgnored(TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* CCheckConfirmDialog: a generic "confirm" dialog including a checkbox.
|
||||
|
|
|
@ -305,15 +305,19 @@ protected:
|
|||
|
||||
#define CDefaultBrowserDlgBase CDialog
|
||||
|
||||
class nsIDefaultBrowser;
|
||||
|
||||
class CDefaultBrowserDlg : public CDefaultBrowserDlgBase
|
||||
{
|
||||
public:
|
||||
CDefaultBrowserDlg(CWnd* pParent = NULL);
|
||||
CDefaultBrowserDlg(CWnd* pParent = NULL, nsIDefaultBrowser* pDefaultBrowser = NULL);
|
||||
CDefaultBrowserDlg(nsIDefaultBrowser* pDefaultBrowser);
|
||||
~CDefaultBrowserDlg();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDefaultBrowserDlg)
|
||||
enum { IDD = IDD_DEFAULT_BROWSER };
|
||||
BOOL m_bIgnore;
|
||||
BOOL m_bPerformCheck;
|
||||
CListBox m_Listbox;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
@ -339,6 +343,9 @@ class CDefaultBrowserDlg : public CDefaultBrowserDlgBase
|
|||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
nsIDefaultBrowser* m_pDefaultBrowser; // nsIDefaultBrowser interface pointer.
|
||||
|
||||
}; // END OF CLASS CDefaultBrowserDlg()
|
||||
|
||||
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape Communications Corporation.
|
||||
Portions created by Netscape are Copyright (C) 1998 Netscape Communications Corporation.
|
||||
All Rights Reserved.
|
||||
*/
|
||||
#include "nsIDefaultBrowser.h"
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "dialog.h"
|
||||
|
||||
class nsWinDefaultBrowser;
|
||||
|
||||
static nsWinDefaultBrowser *pSingleton = NULL;
|
||||
|
||||
// Implementation of the abstract (XP) "default browser" interface for Windows.
|
||||
class nsWinDefaultBrowser : public nsIDefaultBrowser {
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
// Functions to be implemented in this class.
|
||||
NS_IMETHOD_(PRBool) IsDefaultBrowser();
|
||||
NS_IMETHOD_(int) DisplayDialog();
|
||||
|
||||
private:
|
||||
// Constructor (private; use nsIDefaultBrowser::GetInterface).
|
||||
nsWinDefaultBrowser();
|
||||
|
||||
// Destructor clears singleton pointer.
|
||||
virtual ~nsWinDefaultBrowser() {
|
||||
pSingleton = NULL;
|
||||
}
|
||||
|
||||
friend class nsIDefaultBrowser;
|
||||
};
|
||||
|
||||
// Standard implementation of AddRef/Release/QueryInterface.
|
||||
NS_IMPL_ISUPPORTS( nsWinDefaultBrowser, NS_IDEFAULTBROWSER_IID );
|
||||
|
||||
// Minimal ctor.
|
||||
nsWinDefaultBrowser::nsWinDefaultBrowser() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
/* nsWinDefaultBrowser::IsDefaultBrowser
|
||||
*
|
||||
* For now, use old logic.
|
||||
*/
|
||||
PRBool nsWinDefaultBrowser::IsDefaultBrowser() {
|
||||
PRBool result = !theApp.m_OwnedAndLostList.NonemptyLostIgnoredIntersection();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* nsWinDefaultBrowser::DisplayDialog
|
||||
*
|
||||
* Display dialog and return the user response.
|
||||
*/
|
||||
int nsWinDefaultBrowser::DisplayDialog() {
|
||||
CDefaultBrowserDlg dialog;
|
||||
int result = dialog.DoModal();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
nsIDefaultBrowser *nsIDefaultBrowser::GetInterface() {
|
||||
// If singleton hasn't been created, do it now.
|
||||
if ( !pSingleton ) {
|
||||
pSingleton = new nsWinDefaultBrowser;
|
||||
}
|
||||
pSingleton->AddRef();
|
||||
return pSingleton;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape Communications Corporation.
|
||||
Portions created by Netscape are Copyright (C) 1998 Netscape Communications Corporation.
|
||||
All Rights Reserved.
|
||||
*/
|
||||
#ifndef _NSIDEFAULTBROWSER_H_
|
||||
#define _NSIDEFAULTBROWSER_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {C2DACA60-3162-11d2-8049-00600811A9C3}
|
||||
#define NS_IDEFAULTBROWSER_IID \
|
||||
{ 0xc2daca60, 0x3162, 0x11d2, { 0x80, 0x49, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } };
|
||||
|
||||
/* nsIDefaultBrowser:
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
class nsIDefaultBrowser : public nsISupports {
|
||||
public:
|
||||
// GetInterface - static function to be used to get singleton object of this class.
|
||||
static nsIDefaultBrowser *GetInterface();
|
||||
|
||||
// IsDefaultBrowser - return TRUE iff this application is registered as the "default
|
||||
// browser"
|
||||
NS_IMETHOD_(PRBool) IsDefaultBrowser() = 0;
|
||||
|
||||
// DisplayDialog - displays the "default browser" dialog (intended for browser startup).
|
||||
NS_IMETHOD_(int) DisplayDialog() = 0;
|
||||
};
|
||||
|
||||
#endif // _NSIDEFAULTBROWSER_H_
|
|
@ -642,15 +642,14 @@ void CNetscapeApp::CheckDefaultBrowser()
|
|||
{
|
||||
// We're only worrying about this for Win32
|
||||
#ifdef XP_WIN32
|
||||
|
||||
// Construct the App's owned and lost list. Used to determine exactly which
|
||||
// file types were lost. This construction should perform the comparison and
|
||||
// update the lost list. The result will be written out to the registry.
|
||||
m_OwnedAndLostList.ConstructLists();
|
||||
|
||||
XP_Bool prefBool = FALSE;
|
||||
|
||||
PREF_GetBoolPref("browser.wfe.ignore_def_check",&prefBool);
|
||||
|
||||
MakeDefaultBrowser();
|
||||
|
||||
m_OwnedAndLostList.WriteLists();
|
||||
if ( !prefBool ) {
|
||||
MakeDefaultBrowser();
|
||||
}
|
||||
|
||||
#endif // XP_WIN32
|
||||
} // END OF FUNCTION CNetscapeApp::CheckDefaultBrowser()
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "winprefs/isppageo.h"
|
||||
#include "winprefs/brprefid.h"
|
||||
#include "winprefs/wprefid.h"
|
||||
#include "nsIDefaultBrowser.h"
|
||||
#ifdef MOZ_LOC_INDEP
|
||||
#include "winprefs/liprefid.h"
|
||||
#include "winprefs/iliprefs.h"
|
||||
|
@ -2370,7 +2371,12 @@ wfe_DisplayPreferences(CGenericFrame *pFrame)
|
|||
CLSCTX_INPROC_SERVER,
|
||||
IID_ISpecifyPropertyPageObjects,
|
||||
(LPVOID *)&categories[nCategories]))) {
|
||||
nDesktopCategory = nCategories++;
|
||||
IWindowsPrefs *pWinPrefs;
|
||||
if( SUCCEEDED( categories[nCategories]->QueryInterface( IID_IWindowsPrefs, (LPVOID*)&pWinPrefs ) ) ) {
|
||||
pWinPrefs->SetDefaultBrowser( nsIDefaultBrowser::GetInterface() );
|
||||
pWinPrefs->Release();
|
||||
nDesktopCategory = nCategories++;
|
||||
}
|
||||
} else {
|
||||
// Register DLL and try again.
|
||||
RegisterCLSIDForDll( "winpref.dll" );
|
||||
|
@ -2379,7 +2385,12 @@ wfe_DisplayPreferences(CGenericFrame *pFrame)
|
|||
CLSCTX_INPROC_SERVER,
|
||||
IID_ISpecifyPropertyPageObjects,
|
||||
(LPVOID *)&categories[nCategories]))) {
|
||||
nDesktopCategory = nCategories++;
|
||||
IWindowsPrefs *pWinPrefs;
|
||||
if( SUCCEEDED( categories[nCategories]->QueryInterface( IID_IWindowsPrefs, (LPVOID*)&pWinPrefs ) ) ) {
|
||||
pWinPrefs->SetDefaultBrowser( nsIDefaultBrowser::GetInterface() );
|
||||
pWinPrefs->Release();
|
||||
nDesktopCategory = nCategories++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __WPREFID_H_
|
||||
#define __WPREFID_H_
|
||||
|
||||
#ifndef MOZ_COMMUNICATOR_IIDS
|
||||
|
||||
// {464DC700-2727-11d2-8043-00600811A9C3}
|
||||
DEFINE_GUID(IID_IWindowsPrefs,
|
||||
0x464dc700, 0x2727, 0x11d2, 0x80, 0x43, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3);
|
||||
|
||||
// {464DC701-2727-11d2-8043-00600811A9C3}
|
||||
DEFINE_GUID(CLSID_WindowsPrefs,
|
||||
0x464dc701, 0x2727, 0x11d2, 0x80, 0x43, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3);
|
||||
|
||||
#else /* MOZ_COMMUNICATOR_IIDS */
|
||||
|
||||
// {464DC700-2727-11d2-8043-00600811A9C3}
|
||||
DEFINE_GUID(IID_IWindowsPrefs,
|
||||
0x464dc700, 0x2727, 0x11d2, 0x80, 0x43, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3);
|
||||
|
||||
// {464DC701-2727-11d2-8043-00600811A9C3}
|
||||
DEFINE_GUID(CLSID_WindowsPrefs,
|
||||
0x464dc701, 0x2727, 0x11d2, 0x80, 0x43, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3);
|
||||
|
||||
#endif /* MOZ_COMMUNICATOR_IIDS */
|
||||
|
||||
#endif /* __WPREFID_H_ */
|
|
@ -1,62 +0,0 @@
|
|||
IGNORE_MANIFEST=1
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
|
||||
!ifndef MOZ_DEBUG
|
||||
OPTIMIZER=-O1 -UDEBUG -DNDEBUG
|
||||
!endif
|
||||
|
||||
DLLNAME = winpref
|
||||
PDBFILE = $(DLLNAME).pdb
|
||||
MAPFILE = $(DLLNAME).map
|
||||
DLL =.\$(OBJDIR)\$(DLLNAME).dll
|
||||
DEFFILE = winpref.def
|
||||
RESFILE = winpref.res
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
LLIBS = $(DIST)\lib\prefuuid.lib \
|
||||
$(DIST)\lib\dllcom.lib \
|
||||
$(DIST)\lib\nsdlg$(MOZ_BITS).lib \
|
||||
$(DIST)\lib\xppref$(MOZ_BITS).lib
|
||||
LLIBS32 = ole32.lib comdlg32.lib shell32.lib uuid.lib
|
||||
|
||||
!if "$(_MSC_VER)" != "1100" && "$(_MSC_VER)" != "1200"
|
||||
LLIBS32 = $(LLIBS32) uuid2.lib
|
||||
!endif
|
||||
!if defined(MOZ_DEBUG) && defined(GLOWCODE)
|
||||
LLIBS32 = $(LLIBS32) $(GLOWDIR)\glowcode.lib
|
||||
!endif
|
||||
|
||||
LLIBS = $(LLIBS) $(LLIBS32)
|
||||
|
||||
MODULE=winprefs
|
||||
DEPTH=..\..\..\..\..
|
||||
REQUIRES=dllcom winprefs pref dbm nspr js libreg
|
||||
CPPSRCS=winpref.cpp winpages.cpp
|
||||
CPP_OBJS=.\$(OBJDIR)\winpref.obj .\$(OBJDIR)\winpages.obj
|
||||
LINCS=-I$(XPDIST)\public\dllcom -I$(XPDIST)\public\winprefs \
|
||||
-I$(XPDIST)\public\pref -I$(XPDIST)\public\dbm \
|
||||
-I$(XPDIST)\public\nspr -I$(XPDIST)\public\js \
|
||||
-I$(XPDIST)\public\libreg
|
||||
|
||||
!include "$(DEPTH)\config\rules.mak"
|
||||
|
||||
libs:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
|
||||
!if "$(WINOS)" != "WIN95"
|
||||
@$(DIST)\bin\dllreg $(DIST)\bin\$(DLLNAME).dll
|
||||
!endif
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
|
@ -1,57 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __PAGES_H_
|
||||
#define __PAGES_H_
|
||||
|
||||
#include "cppageex.h"
|
||||
#include "xp_list.h"
|
||||
|
||||
//also in brpref\src\advpages.cpp, winfe\mnprefs.cpp
|
||||
#define WINPREF_PrefIsLocked(pPrefName) PREF_PrefIsLocked(pPrefName)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Helper functions
|
||||
|
||||
// CString interface to PREF_GetCharPref routine
|
||||
int
|
||||
PREF_GetStringPref(LPCSTR lpszPref, CString &str);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBasicWindowsPrefs
|
||||
|
||||
class CBasicWindowsPrefs : public CPropertyPageEx {
|
||||
public:
|
||||
CBasicWindowsPrefs();
|
||||
|
||||
protected:
|
||||
BOOL InitDialog();
|
||||
STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal);
|
||||
BOOL DoTransfer(BOOL bSaveAndValidate);
|
||||
BOOL ApplyChanges();
|
||||
|
||||
// Event Processing
|
||||
LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif /* __PAGES_H_ */
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
#include "dllcom.h"
|
||||
#include "pages.h"
|
||||
#include "resource.h"
|
||||
#include "xp_core.h"
|
||||
#include "prefapi.h"
|
||||
#include "structs.h"
|
||||
#include "xp_help.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBasicWindowsPrefs implementation
|
||||
CBasicWindowsPrefs::CBasicWindowsPrefs()
|
||||
: CPropertyPageEx(CComDll::m_hInstance, IDD_BASICWINPREFS, "" ) {
|
||||
// Set member data using XP preferences
|
||||
}
|
||||
|
||||
BOOL CBasicWindowsPrefs::InitDialog()
|
||||
{
|
||||
// Check for locked preferences
|
||||
|
||||
return CPropertyPageEx::InitDialog();
|
||||
}
|
||||
|
||||
STDMETHODIMP CBasicWindowsPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal)
|
||||
{
|
||||
if (!m_bHasBeenActivated) {
|
||||
}
|
||||
|
||||
return CPropertyPageEx::Activate(hwndParent, lprc, bModal);
|
||||
}
|
||||
|
||||
BOOL CBasicWindowsPrefs::DoTransfer(BOOL bSaveAndValidate)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CBasicWindowsPrefs::ApplyChanges()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CBasicWindowsPrefs::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return CPropertyPageEx::WindowProc(uMsg,wParam,lParam);
|
||||
}
|
||||
|
||||
class CWinPrefDialog : public CDialog {
|
||||
public:
|
||||
CWinPrefDialog( int id );
|
||||
|
||||
protected:
|
||||
BOOL InitDialog() { return TRUE; }
|
||||
BOOL DoTransfer(BOOL bSaveAndValidate) { return TRUE; }
|
||||
|
||||
// Event processing
|
||||
void OnOK() { return; }
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
CWinPrefDialog::CWinPrefDialog( int id )
|
||||
: CDialog( CComDll::m_hInstance, id ) {
|
||||
}
|
||||
|
||||
BOOL CBasicWindowsPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode)
|
||||
{
|
||||
BOOL result = TRUE;
|
||||
if ( notifyCode == BN_CLICKED ) {
|
||||
switch ( id ) {
|
||||
case IDD_WINFILETYPES:
|
||||
case IDD_WINSHORTCUTTYPES:
|
||||
case IDD_WINACTIVEDESKTOPSETTINGS:
|
||||
{
|
||||
CWinPrefDialog dialog( id );
|
||||
dialog.DoModal(GetParent(m_hwndDlg));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
result = CPropertyPageEx::OnCommand( id, hwndCtl, notifyCode );
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
result = CPropertyPageEx::OnCommand( id, hwndCtl, notifyCode );
|
||||
}
|
||||
return result;
|
||||
}
|
|
@ -1,385 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "winpref.h"
|
||||
#include "pages.h"
|
||||
#include "wprefid.h"
|
||||
#include "prefuiid.h"
|
||||
#include "isppageo.h"
|
||||
#include <assert.h>
|
||||
|
||||
// Create a new instance of our derived class and return it.
|
||||
CComDll *
|
||||
DLL_ConsumerCreateInstance()
|
||||
{
|
||||
return new CWindowsPrefsDll;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSpecifyPropertyPageObjects
|
||||
|
||||
// Abstract class that supports aggregation as an inner object
|
||||
class CCategory : public IUnknown {
|
||||
public:
|
||||
CCategory();
|
||||
|
||||
// IUnknown methods. Doesn't delegate (explicit IUnknown)
|
||||
STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj) PURE;
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
STDMETHODIMP_(ULONG) Release();
|
||||
|
||||
public:
|
||||
// Abstract nested class that implements ISpecifyPropertyPageObjects
|
||||
class CSpecifyPageObjects : public ISpecifyPropertyPageObjects {
|
||||
public:
|
||||
CSpecifyPageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter);
|
||||
|
||||
// IUnknown methods. Always delegates to controlling unknown
|
||||
STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
STDMETHODIMP_(ULONG) Release();
|
||||
|
||||
// ISpecifyPropertyPageObjects methods
|
||||
STDMETHODIMP GetPageObjects(CAPPAGE FAR* pPages) PURE;
|
||||
|
||||
private:
|
||||
CCategory *m_pBackObj;
|
||||
LPUNKNOWN m_pUnkOuter;
|
||||
};
|
||||
|
||||
private:
|
||||
ULONG m_uRef;
|
||||
};
|
||||
|
||||
CCategory::CCategory()
|
||||
{
|
||||
m_uRef = 0;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG)
|
||||
CCategory::AddRef()
|
||||
{
|
||||
return ++m_uRef;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG)
|
||||
CCategory::Release()
|
||||
{
|
||||
if (--m_uRef == 0) {
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString("Destroying CCategory object.\n");
|
||||
#endif
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_uRef;
|
||||
}
|
||||
|
||||
CCategory::CSpecifyPageObjects::CSpecifyPageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter)
|
||||
{
|
||||
assert(pBackObj);
|
||||
|
||||
// Don't add references to either the back pointer or the controlling unknown
|
||||
m_pBackObj = pBackObj;
|
||||
m_pUnkOuter = pUnkOuter;
|
||||
|
||||
// If we're not being aggregated then pUnkOuter will be NULL. In that case
|
||||
// delegate to the object in which we're contained
|
||||
if (!m_pUnkOuter)
|
||||
m_pUnkOuter = pBackObj;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CCategory::CSpecifyPageObjects::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
|
||||
{
|
||||
// Delegate to the controlling unknown
|
||||
assert(m_pUnkOuter);
|
||||
return m_pUnkOuter->QueryInterface(riid, ppvObj);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG)
|
||||
CCategory::CSpecifyPageObjects::AddRef()
|
||||
{
|
||||
// Delegate to the controlling unknown
|
||||
assert(m_pUnkOuter);
|
||||
return m_pUnkOuter->AddRef();
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG)
|
||||
CCategory::CSpecifyPageObjects::Release()
|
||||
{
|
||||
// Delegate to the controlling unknown
|
||||
assert(m_pUnkOuter);
|
||||
return m_pUnkOuter->Release();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMailNewsCategory
|
||||
|
||||
class CWindowsCategory : public CCategory {
|
||||
public:
|
||||
CWindowsCategory(LPUNKNOWN pUnkOuter);
|
||||
|
||||
// IUnknown methods. Doesn't delegate (explicit IUnknown)
|
||||
STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
|
||||
|
||||
private:
|
||||
class CSpecifyWindowsPageObjects : public CCategory::CSpecifyPageObjects {
|
||||
public:
|
||||
CSpecifyWindowsPageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter);
|
||||
|
||||
// ISpecifyPropertyPageObjects methods
|
||||
STDMETHODIMP GetPageObjects(CAPPAGE *pPages);
|
||||
};
|
||||
|
||||
CSpecifyWindowsPageObjects m_innerObj;
|
||||
};
|
||||
|
||||
CWindowsCategory::CWindowsCategory(LPUNKNOWN pUnkOuter)
|
||||
: m_innerObj(this, pUnkOuter)
|
||||
{
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CWindowsCategory::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
|
||||
{
|
||||
if (riid == IID_IUnknown) {
|
||||
*ppvObj = (LPVOID)this;
|
||||
AddRef();
|
||||
return NOERROR;
|
||||
|
||||
} else if (riid == IID_ISpecifyPropertyPageObjects) {
|
||||
*ppvObj = (LPVOID)&m_innerObj;
|
||||
m_innerObj.AddRef();
|
||||
return NOERROR;
|
||||
|
||||
} else {
|
||||
*ppvObj = NULL;
|
||||
return ResultFromScode(E_NOINTERFACE);
|
||||
}
|
||||
}
|
||||
|
||||
CWindowsCategory::CSpecifyWindowsPageObjects::CSpecifyWindowsPageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter)
|
||||
: CSpecifyPageObjects(pBackObj, pUnkOuter)
|
||||
{
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CWindowsCategory::CSpecifyWindowsPageObjects::GetPageObjects(CAPPAGE *pPages)
|
||||
{
|
||||
if (!pPages)
|
||||
return ResultFromScode(E_POINTER);
|
||||
|
||||
pPages->cElems = 1;
|
||||
pPages->pElems = (LPPROPERTYPAGE *)CoTaskMemAlloc(pPages->cElems * sizeof(LPPROPERTYPAGE));
|
||||
if (!pPages->pElems)
|
||||
return ResultFromScode(E_OUTOFMEMORY);
|
||||
|
||||
pPages->pElems[0] = new CBasicWindowsPrefs;
|
||||
|
||||
for (ULONG i = 0; i < pPages->cElems; i++)
|
||||
pPages->pElems[i]->AddRef();
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class CPropertyPageFactory
|
||||
|
||||
// Class factory for our property pages. We use the same C++ class
|
||||
// to handle all of our CLSIDs
|
||||
class CPropertyPageFactory : public IClassFactory {
|
||||
public:
|
||||
CPropertyPageFactory(REFCLSID rClsid);
|
||||
|
||||
// *** IUnknown methods ***
|
||||
STDMETHODIMP QueryInterface(REFIID, LPVOID FAR*);
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
STDMETHODIMP_(ULONG) Release();
|
||||
|
||||
// *** IClassFactory methods ***
|
||||
STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR*);
|
||||
STDMETHODIMP LockServer(BOOL bLock);
|
||||
|
||||
private:
|
||||
CRefDll m_refDll;
|
||||
ULONG m_uRef;
|
||||
CLSID m_clsid;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPropertyPageFactory implementation
|
||||
|
||||
CPropertyPageFactory::CPropertyPageFactory(REFCLSID rClsid)
|
||||
{
|
||||
m_uRef = 0;
|
||||
m_clsid = rClsid;
|
||||
}
|
||||
|
||||
// *** IUnknown methods ***
|
||||
STDMETHODIMP CPropertyPageFactory::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
|
||||
{
|
||||
*ppvObj = NULL;
|
||||
|
||||
if (riid == IID_IUnknown || riid == IID_IClassFactory)
|
||||
*ppvObj = (LPVOID)this;
|
||||
|
||||
if (*ppvObj) {
|
||||
AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
return ResultFromScode(E_NOINTERFACE);
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP_(ULONG) CPropertyPageFactory::AddRef()
|
||||
{
|
||||
return ++m_uRef;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP_(ULONG) CPropertyPageFactory::Release(void)
|
||||
{
|
||||
if (--m_uRef == 0) {
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString("Destroying CPropertyPageFactory class object.\n");
|
||||
#endif
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_uRef;
|
||||
}
|
||||
|
||||
// *** IClassFactory methods ***
|
||||
STDMETHODIMP CPropertyPageFactory::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppvObj)
|
||||
{
|
||||
// When requesting aggregation, the outer object must explicitly ask
|
||||
// for IUnknown
|
||||
if (pUnkOuter && riid != IID_IUnknown)
|
||||
return ResultFromScode(CLASS_E_NOAGGREGATION);
|
||||
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString("CPropertyPageFactory::CreateInstance() called.\n");
|
||||
#endif
|
||||
LPUNKNOWN pCategory;
|
||||
|
||||
if (m_clsid == CLSID_WindowsPrefs)
|
||||
pCategory = new CWindowsCategory(pUnkOuter);
|
||||
|
||||
if (!pCategory)
|
||||
return ResultFromScode(E_OUTOFMEMORY);
|
||||
|
||||
pCategory->AddRef();
|
||||
HRESULT hRes = pCategory->QueryInterface(riid, ppvObj);
|
||||
pCategory->Release();
|
||||
return hRes;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CPropertyPageFactory::LockServer(BOOL bLock)
|
||||
{
|
||||
CComDll *pDll = CProcess::GetProcessDll();
|
||||
HRESULT hres;
|
||||
|
||||
assert(pDll);
|
||||
hres = CoLockObjectExternal(pDll, bLock, TRUE);
|
||||
pDll->Release();
|
||||
return hres;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CWindowsPrefsDll implementation
|
||||
|
||||
HRESULT
|
||||
CWindowsPrefsDll::GetClassObject(REFCLSID rClsid, REFIID riid, LPVOID *ppObj)
|
||||
{
|
||||
HRESULT hres = ResultFromScode(E_UNEXPECTED);
|
||||
*ppObj = NULL;
|
||||
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString("CWindowsPrefsDll::GetClassObject() called.\n");
|
||||
#endif
|
||||
|
||||
// See if we have that particular class object.
|
||||
if (rClsid == CLSID_WindowsPrefs) {
|
||||
|
||||
// Create a class object
|
||||
CPropertyPageFactory *pFactory = new CPropertyPageFactory(rClsid);
|
||||
|
||||
if (!pFactory)
|
||||
return ResultFromScode(E_OUTOFMEMORY);
|
||||
|
||||
// Get the desired interface. Note if the QueryInterface fails, the Release
|
||||
// will delete the class object
|
||||
pFactory->AddRef();
|
||||
hres = pFactory->QueryInterface(riid, ppObj);
|
||||
pFactory->Release();
|
||||
|
||||
} else {
|
||||
hres = ResultFromScode(CLASS_E_CLASSNOTAVAILABLE);
|
||||
}
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
// Return array of implemented CLSIDs by this DLL. Allocated
|
||||
// memory freed by caller.
|
||||
const CLSID **
|
||||
CWindowsPrefsDll::GetCLSIDs()
|
||||
{
|
||||
const CLSID **ppRetval = (const CLSID **)CoTaskMemAlloc(sizeof(CLSID *) * 2);
|
||||
|
||||
if (ppRetval) {
|
||||
ppRetval[0] = &CLSID_WindowsPrefs;
|
||||
ppRetval[1] = NULL;
|
||||
}
|
||||
|
||||
return ppRetval;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
// The DLL is being loaded for the first time by a given process
|
||||
CComDll::m_hInstance = hInstance;
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
// The DLL is being unloaded by a given process
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
// A thread is being created in a process that has already loaded
|
||||
// this DLL
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
// A thread is exiting cleanly in a process that has already
|
||||
// loaded this DLL
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче