зеркало из https://github.com/mozilla/gecko-dev.git
XP_WIN versions of the privacy FE dialogs
This commit is contained in:
Родитель
4eedd54c45
Коммит
f144820e06
|
@ -215,6 +215,50 @@ XP_Bool CFE_Confirm(MWContext *pContext, const char *pConfirmMessage) {
|
|||
return(bReturn);
|
||||
}
|
||||
|
||||
/* return value reflects whether the dialog was OKed (TRUE if OKed) */
|
||||
extern XP_Bool CFE_CheckConfirm(MWContext *pContext,
|
||||
const char *pConfirmMessage, /* main text in dialog */
|
||||
const char *pCheckMessage, /* text for checkbox */
|
||||
const char *pOKMessage, /* text for OK button */
|
||||
const char *pCancelMessage, /* text for cancel button */
|
||||
XP_Bool *pChecked) { /* in: initial state of checkbox */
|
||||
/* out: state of checkbox */
|
||||
|
||||
// skip destroyed contexts
|
||||
if(ABSTRACTCX(pContext)->IsDestroyed()) {
|
||||
TRACE("Context %p Destroyed :: CheckConfirm Blocking\n", pContext);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char *winMsg = FE_Windowsify(pConfirmMessage);
|
||||
XP_Bool accepted = ABSTRACTCX(pContext)->CheckConfirm(pContext, winMsg,
|
||||
pCheckMessage, pOKMessage, pCancelMessage, pChecked);
|
||||
XP_FREE(winMsg);
|
||||
|
||||
return accepted;
|
||||
}
|
||||
|
||||
/* return value reflects whether the dialog was OKed (TRUE if OKed) */
|
||||
extern XP_Bool CFE_SelectDialog(MWContext *pContext,
|
||||
const char *pMessage, /* message above the list */
|
||||
const char **pList, /* array of entries in the list */
|
||||
int *pCount) { /* in: # items in list */
|
||||
/* out: 0-based index of selected item */
|
||||
|
||||
// skip destroyed contexts
|
||||
if(ABSTRACTCX(pContext)->IsDestroyed()) {
|
||||
TRACE("Context %p Destroyed :: SelectDialog Blocking\n", pContext);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char *winMsg = FE_Windowsify(pMessage);
|
||||
XP_Bool accepted = ABSTRACTCX(pContext)->SelectDialog(pContext,
|
||||
winMsg, pList, pCount);
|
||||
XP_FREE(winMsg);
|
||||
|
||||
return accepted;
|
||||
}
|
||||
|
||||
MWContext *CFE_CreateNewDocWindow(MWContext *pContext, URL_Struct *pURL) {
|
||||
if(pContext != NULL) {
|
||||
if(ABSTRACTCX(pContext)->IsDestroyed()) {
|
||||
|
|
|
@ -273,6 +273,33 @@ XP_Bool CStubsCX::Confirm(MWContext *pContext, const char *pConfirmMessage) {
|
|||
return(iStatus == IDOK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Run a "confirm" dialog with a checkbox
|
||||
*/
|
||||
BOOL CStubsCX::CheckConfirm(MWContext *pContext, const char *pMessage,
|
||||
const char *pCheckMessage, const char *pOKMessage,
|
||||
const char *pCancelMessage, XP_Bool *pChecked) {
|
||||
|
||||
CCheckConfirmDialog dialog(GetDialogOwner(), pMessage, pCheckMessage,
|
||||
pOKMessage, pCancelMessage, *pChecked);
|
||||
|
||||
theApp.m_splash.SafeHide();
|
||||
return dialog.DoModal(pChecked);
|
||||
}
|
||||
|
||||
/*
|
||||
* Run a dialog allowing selection from a list
|
||||
*/
|
||||
BOOL CStubsCX::SelectDialog(MWContext *pContext, const char *pMessage,
|
||||
const char **pList, int *pCount) {
|
||||
|
||||
CUserSelectionDialog dialog(GetDialogOwner(), pMessage,
|
||||
pList, *pCount);
|
||||
|
||||
theApp.m_splash.SafeHide();
|
||||
return dialog.DoModal(pCount);
|
||||
}
|
||||
|
||||
MWContext *CStubsCX::CreateNewDocWindow(MWContext *pContext, URL_Struct *pURL) {
|
||||
return(NULL);
|
||||
}
|
||||
|
|
|
@ -943,3 +943,388 @@ void CDefaultBrowserDlg::OnOK()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* CCheckConfirmDialog: a generic "confirm" dialog including a checkbox.
|
||||
It's used by XP.
|
||||
*/
|
||||
|
||||
BEGIN_MESSAGE_MAP(CCheckConfirmDialog, CSelfAdjustingDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
CCheckConfirmDialog::CCheckConfirmDialog (CWnd *pParent,
|
||||
const char *pMessage, const char *pCheckMessage,
|
||||
const char *pOKMessage, const char *pCancelMessage,
|
||||
BOOL checked) :
|
||||
|
||||
CSelfAdjustingDialog(CCheckConfirmDialog::IDD, pParent),
|
||||
mMessage(pMessage), mCheckMessage(pCheckMessage),
|
||||
mOKMessage(pOKMessage), mCancelMessage(pCancelMessage)
|
||||
{
|
||||
mCheckState = checked ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL CCheckConfirmDialog::OnInitDialog()
|
||||
{
|
||||
CSelfAdjustingDialog::OnInitDialog();
|
||||
|
||||
CStatic *messageItem = (CStatic *) GetDlgItem(IDC_STATIC1);
|
||||
CButton *checkItem = (CButton *) GetDlgItem(IDC_CHECK1),
|
||||
*okButton = (CButton *) GetDlgItem(IDOK),
|
||||
*cancelButton = (CButton *) GetDlgItem(IDCANCEL);
|
||||
POINT windRectDiff,
|
||||
border;
|
||||
|
||||
// set subwindows' text
|
||||
messageItem->SetWindowText((const char *) mMessage);
|
||||
checkItem->SetWindowText((const char *) mCheckMessage);
|
||||
if (!mOKMessage.IsEmpty())
|
||||
okButton->SetWindowText((const char *) mOKMessage);
|
||||
if (!mCancelMessage.IsEmpty())
|
||||
cancelButton->SetWindowText((const char *) mCancelMessage);
|
||||
checkItem->SetCheck(mCheckState);
|
||||
|
||||
// adjust sizes to match text
|
||||
CheckOverallSize(&border, FALSE);
|
||||
ResizeItemToFitText(messageItem, (const char *) mMessage, &windRectDiff);
|
||||
AdjustForItemSize(messageItem, &windRectDiff);
|
||||
ResizeItemToFitText(checkItem, (const char *) mCheckMessage, &windRectDiff);
|
||||
AdjustForItemSize(checkItem, &windRectDiff);
|
||||
AdjustButtons(okButton, cancelButton, border.x);
|
||||
CheckOverallSize(&border, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CCheckConfirmDialog::DoModal(XP_Bool *checkboxSet)
|
||||
{
|
||||
BOOL rtnval = CSelfAdjustingDialog::DoModal() == IDOK;
|
||||
*checkboxSet = mCheckState == 1;
|
||||
return rtnval;
|
||||
}
|
||||
|
||||
void CCheckConfirmDialog::OnOK()
|
||||
{
|
||||
CButton *checkItem = (CButton *) GetDlgItem(IDC_CHECK1);
|
||||
mCheckState = checkItem->GetCheck() == 1;
|
||||
CSelfAdjustingDialog::OnOK();
|
||||
}
|
||||
|
||||
/* "cancel" really means "no," so fetch the value of the checkbox */
|
||||
void CCheckConfirmDialog::OnCancel()
|
||||
{
|
||||
CButton *checkItem = (CButton *) GetDlgItem(IDC_CHECK1);
|
||||
mCheckState = checkItem->GetCheck() == 1;
|
||||
CSelfAdjustingDialog::OnCancel();
|
||||
}
|
||||
|
||||
/* if (!adjust), calculate the border around our subwindows.
|
||||
if (adjust), resize to have the given border. */
|
||||
void CCheckConfirmDialog::CheckOverallSize(LPPOINT diff, BOOL adjust) {
|
||||
|
||||
CStatic *messageItem = (CStatic *) GetDlgItem(IDC_STATIC1);
|
||||
CButton *checkItem = (CButton *) GetDlgItem(IDC_CHECK1),
|
||||
*okButton = (CButton *) GetDlgItem(IDOK),
|
||||
*cancelButton = (CButton *) GetDlgItem(IDCANCEL);
|
||||
RECT wRect,
|
||||
parentRect;
|
||||
POINT border;
|
||||
HWND parent = m_pParentWnd ? m_pParentWnd->GetSafeHwnd() : NULL;
|
||||
|
||||
// calculate current minimum border. assumes buttons fix the bottom margin and
|
||||
// other items fix the right margin
|
||||
messageItem->GetWindowRect(&wRect);
|
||||
border.x = wRect.right;
|
||||
checkItem->GetWindowRect(&wRect);
|
||||
if (wRect.right > border.x)
|
||||
border.x = wRect.right;
|
||||
cancelButton->GetWindowRect(&wRect);
|
||||
border.y = wRect.bottom;
|
||||
if (wRect.right > border.x)
|
||||
border.x = wRect.right;
|
||||
GetWindowRect(&wRect);
|
||||
|
||||
if (adjust) {
|
||||
// since moving the window seems to make the system no longer center it,
|
||||
// we have to do it ourselves
|
||||
if (m_pParentWnd)
|
||||
m_pParentWnd->GetWindowRect(&parentRect);
|
||||
else
|
||||
GetDesktopWindow()->GetWindowRect(&parentRect);
|
||||
|
||||
// adjust dialog window size to keep the same borders between it and its subwindows
|
||||
border.x = diff->x - (wRect.right - border.x);
|
||||
border.y = diff->y - (wRect.bottom - border.y);
|
||||
wRect.right += border.x;
|
||||
wRect.bottom += border.y;
|
||||
|
||||
// center it in its parent
|
||||
border.x = ((parentRect.right + parentRect.left) - (wRect.right + wRect.left)) / 2;
|
||||
border.y = ((parentRect.bottom + parentRect.top) - (wRect.bottom + wRect.top)) / 2;
|
||||
wRect.left += border.x;
|
||||
wRect.right += border.x;
|
||||
wRect.top += border.y;
|
||||
wRect.bottom += border.y;
|
||||
MoveWindow(&wRect, TRUE);
|
||||
} else {
|
||||
diff->x = wRect.right - border.x;
|
||||
diff->y = wRect.bottom - border.y;
|
||||
}
|
||||
}
|
||||
|
||||
/* special adjustment for the buttons. we won't make them smaller, and we'll keep
|
||||
them centered. we also assume they're in a row at the bottom, with OK on the left,
|
||||
and the same size. */
|
||||
void CCheckConfirmDialog::AdjustButtons(CWnd *okButton, CWnd *cancelButton,
|
||||
LONG expectedMargin) {
|
||||
|
||||
RECT okRect,
|
||||
cancelRect,
|
||||
newOKRect,
|
||||
newCancelRect,
|
||||
dialogRect;
|
||||
POINT diff,
|
||||
tempDiff;
|
||||
LONG separation,
|
||||
width;
|
||||
|
||||
// assume if OK has no text change, than cancel doesn't either. no adjustment, then.
|
||||
if (mOKMessage.IsEmpty())
|
||||
return;
|
||||
|
||||
okButton->GetWindowRect(&okRect);
|
||||
cancelButton->GetWindowRect(&cancelRect);
|
||||
GetWindowRect(&dialogRect);
|
||||
|
||||
// calculate appropriate size
|
||||
RectForText(okButton, (const char *) mOKMessage, &newOKRect, &diff);
|
||||
RectForText(cancelButton, (const char *) mCancelMessage, &newCancelRect, &tempDiff);
|
||||
if (newOKRect.right - newOKRect.left > newCancelRect.right - newCancelRect.left)
|
||||
width = newOKRect.right - newOKRect.left;
|
||||
else {
|
||||
width = newCancelRect.right - newCancelRect.left;
|
||||
diff.x = tempDiff.x;
|
||||
}
|
||||
|
||||
// don't shrink the buttons; only expand them
|
||||
if (diff.x > 0) {
|
||||
separation = cancelRect.left - okRect.right;
|
||||
okRect.left -= diff.x;
|
||||
cancelRect.right += diff.x;
|
||||
if (okRect.left - dialogRect.left < expectedMargin) {
|
||||
okRect.left = dialogRect.left + expectedMargin;
|
||||
okRect.right = okRect.left + width;
|
||||
}
|
||||
if (cancelRect.left < okRect.right + separation) {
|
||||
cancelRect.left = okRect.right + separation;
|
||||
cancelRect.right = cancelRect.left + width;
|
||||
}
|
||||
::MapWindowPoints(HWND_DESKTOP, GetSafeHwnd(), (LPPOINT) &okRect, 2);
|
||||
::MapWindowPoints(HWND_DESKTOP, GetSafeHwnd(), (LPPOINT) &cancelRect, 2);
|
||||
okButton->MoveWindow(&okRect, TRUE);
|
||||
cancelButton->MoveWindow(&cancelRect, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* CUserSelectionDialog: presents a scrolling list of items with an initial
|
||||
selection, allowing the user to specify a selection
|
||||
*/
|
||||
BEGIN_MESSAGE_MAP(CUserSelectionDialog, CDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
CUserSelectionDialog::CUserSelectionDialog(CWnd *pParent, const char *pMessage,
|
||||
const char **pUserList, int nUserListCount) :
|
||||
|
||||
CDialog(CUserSelectionDialog::IDD, pParent),
|
||||
mMessage(pMessage) {
|
||||
|
||||
int ctr;
|
||||
|
||||
mSelection = -1;
|
||||
// copy pUserList
|
||||
mList = (char **) XP_ALLOC(nUserListCount*sizeof(char *));
|
||||
mListCount = nUserListCount;
|
||||
if (mList) {
|
||||
for (ctr = 0; ctr < nUserListCount; ctr++) {
|
||||
int len = 1 + XP_STRLEN(pUserList[ctr]);
|
||||
char *newStr = (char *) XP_ALLOC(len*sizeof(char));
|
||||
if (newStr) {
|
||||
XP_STRCPY(newStr, pUserList[ctr]);
|
||||
mList[ctr] = newStr;
|
||||
} else {
|
||||
mListCount = ctr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mListCount == 0) {
|
||||
XP_FREE(mList);
|
||||
mList = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CUserSelectionDialog::~CUserSelectionDialog() {
|
||||
|
||||
int ctr;
|
||||
|
||||
if (mList) {
|
||||
for (ctr = 0; ctr < mListCount; ctr++)
|
||||
XP_FREE(mList[ctr]);
|
||||
XP_FREE(mList);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CUserSelectionDialog::DoModal(LPINT nSelection)
|
||||
{
|
||||
BOOL rtnval = CDialog::DoModal() == IDOK;
|
||||
*nSelection = mSelection;
|
||||
return rtnval;
|
||||
}
|
||||
|
||||
void CUserSelectionDialog::OnOK()
|
||||
{
|
||||
CListBox *listItem = (CListBox *) GetDlgItem(IDC_LIST1);
|
||||
mSelection = listItem->GetCurSel();
|
||||
if (mSelection == LB_ERR)
|
||||
mSelection = -1;
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
BOOL CUserSelectionDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CStatic *messageItem = (CStatic *) GetDlgItem(IDC_STATIC1);
|
||||
CListBox *listItem = (CListBox *) GetDlgItem(IDC_LIST1);
|
||||
int ctr;
|
||||
|
||||
// set subwindows' text
|
||||
messageItem->SetWindowText((const char *) mMessage);
|
||||
if (mList)
|
||||
for (ctr = 0; ctr < mListCount; ctr++) {
|
||||
int err;
|
||||
err = listItem->AddString(mList[ctr]);
|
||||
if (err == LB_ERR || err == LB_ERRSPACE)
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* CSelfAdjustingDialog: some base code for a dialog that can adjust its size
|
||||
and its subwindows
|
||||
*/
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSelfAdjustingDialog, CDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
CSelfAdjustingDialog::CSelfAdjustingDialog(UINT nIDTemplate, CWnd* pParent) :
|
||||
CDialog(nIDTemplate, pParent) {
|
||||
}
|
||||
|
||||
/* calculate appropriate window rect for its text. assumes average character width.
|
||||
returns actual (desktop-relative) window rect, adjusted for appropriate size,
|
||||
(without actually changing the window's rect). */
|
||||
void CSelfAdjustingDialog::RectForText(CWnd *window, const char *text,
|
||||
LPRECT wrect, LPPOINT diff) {
|
||||
|
||||
int height,
|
||||
width;
|
||||
const char *mark;
|
||||
char thisChar;
|
||||
BOOL lastWasCR;
|
||||
CDC *dc = window->GetDC();
|
||||
CSize basicExtent = dc->GetTextExtent("W",1),
|
||||
extent;
|
||||
|
||||
window->GetWindowRect(wrect);
|
||||
|
||||
// calculate width and height of text.
|
||||
height = 0;
|
||||
width = 0;
|
||||
mark = text;
|
||||
lastWasCR = FALSE;
|
||||
while (1) {
|
||||
thisChar = *text;
|
||||
if (lastWasCR && thisChar == '\n') {
|
||||
lastWasCR = FALSE;
|
||||
mark = ++text;
|
||||
continue;
|
||||
}
|
||||
if (thisChar == '\r' || thisChar == '\n' || thisChar == '\0') {
|
||||
if (text-mark == 0) // it's a zero-length line
|
||||
height += basicExtent.cy;
|
||||
else {
|
||||
extent = dc->GetTextExtent(mark, text-mark);
|
||||
if (width < extent.cx)
|
||||
width = extent.cx;
|
||||
height += extent.cy;
|
||||
}
|
||||
mark = text+1;
|
||||
if (*text == '\0')
|
||||
break;
|
||||
}
|
||||
lastWasCR = *text++ == '\r';
|
||||
}
|
||||
if (width == 0)
|
||||
width = basicExtent.cx;
|
||||
if (height == 0)
|
||||
height = basicExtent.cy;
|
||||
diff->x = width - (wrect->right - wrect->left);
|
||||
diff->y = height - (wrect->bottom - wrect->top);
|
||||
wrect->right = wrect->left + width;
|
||||
wrect->bottom = wrect->top + height;
|
||||
}
|
||||
|
||||
/* resize subwindow to fit its text. assumes average character width */
|
||||
void CSelfAdjustingDialog::ResizeItemToFitText(CWnd *window, const char *text, LPPOINT diff) {
|
||||
|
||||
RECT windRect;
|
||||
|
||||
RectForText(window, text, &windRect, diff);
|
||||
::MapWindowPoints(HWND_DESKTOP, GetSafeHwnd(), (LPPOINT) &windRect, 2);
|
||||
window->MoveWindow(&windRect, TRUE);
|
||||
}
|
||||
|
||||
/* adjust window size for a change in an item size, and then adjust positions of
|
||||
affected subwindows */
|
||||
void CCheckConfirmDialog::AdjustForItemSize(CWnd *afterWind, LPPOINT diff) {
|
||||
|
||||
CStatic *messageItem = (CStatic *) GetDlgItem(IDC_STATIC1);
|
||||
CButton *checkItem = (CButton *) GetDlgItem(IDC_CHECK1),
|
||||
*okButton = (CButton *) GetDlgItem(IDOK),
|
||||
*cancelButton = (CButton *) GetDlgItem(IDCANCEL);
|
||||
HWND parent = m_pParentWnd ? m_pParentWnd->GetSafeHwnd() : NULL;
|
||||
|
||||
// adjust positions of trailing subwindows
|
||||
BumpItemIfAfter(messageItem, afterWind, diff);
|
||||
BumpItemIfAfter(checkItem, afterWind, diff);
|
||||
BumpItemIfAfter(okButton, afterWind, diff);
|
||||
BumpItemIfAfter(cancelButton, afterWind, diff);
|
||||
}
|
||||
|
||||
/* adjust subwindows affected by a change in size of another subwindow */
|
||||
void CSelfAdjustingDialog::BumpItemIfAfter(CWnd *item, CWnd *afterWind, LPPOINT diff) {
|
||||
|
||||
RECT afterRect,
|
||||
itemRect;
|
||||
|
||||
item->GetWindowRect(&itemRect);
|
||||
afterWind->GetWindowRect(&afterRect);
|
||||
if ( diff->x != 0 &&
|
||||
itemRect.left > afterRect.left &&
|
||||
itemRect.top < afterRect.bottom && itemRect.bottom >= afterRect.top) {
|
||||
::MapWindowPoints(HWND_DESKTOP, GetSafeHwnd(), (LPPOINT) &itemRect, 2);
|
||||
itemRect.left += diff->x;
|
||||
itemRect.right += diff->x;
|
||||
item->MoveWindow(&itemRect, TRUE);
|
||||
}
|
||||
else if ( diff->y != 0 &&
|
||||
itemRect.top > afterRect.top &&
|
||||
itemRect.left < afterRect.right && itemRect.right >= afterRect.left) {
|
||||
::MapWindowPoints(HWND_DESKTOP, GetSafeHwnd(), (LPPOINT) &itemRect, 2);
|
||||
itemRect.top += diff->y;
|
||||
itemRect.bottom += diff->y;
|
||||
item->MoveWindow(&itemRect, TRUE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -341,4 +341,74 @@ class CDefaultBrowserDlg : public CDefaultBrowserDlgBase
|
|||
}; // END OF CLASS CDefaultBrowserDlg()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// basic dialog that knows how to adjust itself to fit its contents
|
||||
|
||||
class FAR CSelfAdjustingDialog : public CDialog
|
||||
{
|
||||
public:
|
||||
CSelfAdjustingDialog(UINT nIDTemplate, CWnd *pParent);
|
||||
protected:
|
||||
virtual void RectForText(CWnd *window, const char *text, LPRECT wrect, LPPOINT diff);
|
||||
virtual void ResizeItemToFitText(CWnd *window, const char *text,
|
||||
LPPOINT diff);
|
||||
virtual void BumpItemIfAfter(CWnd *item, CWnd *afterWind, LPPOINT diff);
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CheckConfirm dialog
|
||||
|
||||
class FAR CCheckConfirmDialog : public CSelfAdjustingDialog
|
||||
{
|
||||
public:
|
||||
CCheckConfirmDialog(CWnd *pParent, const char *pMessage, const char *pCheckMessage,
|
||||
const char *pOKMessage, const char *pCancelMessage, BOOL checked);
|
||||
|
||||
enum { IDD = IDD_CHECKCONFIRM_BOX };
|
||||
|
||||
BOOL DoModal(XP_Bool *checkboxSet);
|
||||
|
||||
protected:
|
||||
CString mMessage,
|
||||
mCheckMessage,
|
||||
mOKMessage,
|
||||
mCancelMessage;
|
||||
int mCheckState;
|
||||
|
||||
void AdjustButtons(CWnd *okButton, CWnd *cancelButton, LONG expectedMargin);
|
||||
void AdjustForItemSize(CWnd *afterWind, LPPOINT diff);
|
||||
void CheckOverallSize(LPPOINT diff, BOOL adjust);
|
||||
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual void OnOK();
|
||||
virtual void OnCancel();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Single User Signon User Selection Dialog
|
||||
|
||||
class FAR CUserSelectionDialog : public CDialog
|
||||
{
|
||||
public:
|
||||
CUserSelectionDialog(CWnd *pParent, const char *pMessage,
|
||||
const char **pUserList, int nUserListCount);
|
||||
~CUserSelectionDialog();
|
||||
|
||||
enum { IDD = IDD_SELECT_BOX };
|
||||
|
||||
BOOL DoModal(LPINT nSelection);
|
||||
|
||||
protected:
|
||||
CString mMessage;
|
||||
char **mList;
|
||||
int mListCount;
|
||||
int mSelection;
|
||||
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual void OnOK();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#endif /* _DIALOG_H_ */
|
||||
|
|
|
@ -786,6 +786,7 @@ BEGIN_MESSAGE_MAP(CGenericFrame, CFrameWnd)
|
|||
ON_COMMAND(ID_PRIVACY_DISPLAY_COOKIES, OnDisplayPrivacyCookies)
|
||||
ON_COMMAND(ID_PRIVACY_DISPLAY_SIGNONS, OnDisplayPrivacySignons)
|
||||
ON_COMMAND(ID_PRIVACY_DISPLAY_RECEIPTS, OnDisplayPrivacyReceipts)
|
||||
ON_COMMAND(ID_PRIVACY_DISPLAY_SITEINFO, OnDisplayPrivacySiteInfo)
|
||||
ON_COMMAND(ID_PRIVACY_DISPLAY_TUTORIAL, OnDisplayPrivacyTutorial)
|
||||
#if defined(OJI) || defined(JAVA)
|
||||
ON_COMMAND(ID_OPTIONS_SHOWJAVACONSOLE, OnToggleJavaConsole)
|
||||
|
@ -2345,6 +2346,11 @@ void CGenericFrame::OnDisplayPrivacyReceipts()
|
|||
{
|
||||
}
|
||||
|
||||
void CGenericFrame::OnDisplayPrivacySiteInfo()
|
||||
{
|
||||
// needs to be hooked up
|
||||
}
|
||||
|
||||
void CGenericFrame::OnDisplayPrivacyTutorial()
|
||||
{
|
||||
GetMainContext()->NormalGetUrl(PRVCY_TutorialURL());
|
||||
|
|
|
@ -282,6 +282,7 @@ protected:
|
|||
afx_msg void OnDisplayPrivacyCookies();
|
||||
afx_msg void OnDisplayPrivacySignons();
|
||||
afx_msg void OnDisplayPrivacyReceipts();
|
||||
afx_msg void OnDisplayPrivacySiteInfo();
|
||||
afx_msg void OnDisplayPrivacyTutorial();
|
||||
|
||||
afx_msg void OnSecurity();
|
||||
|
|
|
@ -3031,6 +3031,7 @@ BEGIN
|
|||
ID_PRIVACY_DISPLAY_COOKIES "Display list of cookies"
|
||||
ID_PRIVACY_DISPLAY_SIGNONS "Display list of remembered signons"
|
||||
ID_PRIVACY_DISPLAY_RECEIPTS "Display list of saved receipts"
|
||||
ID_PRIVACY_DISPLAY_SITEINFO "Privacy Central"
|
||||
ID_PRIVACY_DISPLAY_TUTORIAL "Show tutorial on privacy"
|
||||
END
|
||||
|
||||
|
|
|
@ -691,7 +691,8 @@ BEGIN
|
|||
MENUITEM "Display &Receipts", ID_PRIVACY_DISPLAY_RECEIPTS
|
||||
#endif
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Tutorial", ID_PRIVACY_DISPLAY_TUTORIAL
|
||||
MENUITEM "A&bout Site", ID_PRIVACY_DISPLAY_SITEINFO
|
||||
MENUITEM "Ab&out Privacy", ID_PRIVACY_DISPLAY_TUTORIAL
|
||||
END
|
||||
|
||||
MENUITEM SEPARATOR
|
||||
|
@ -1074,6 +1075,30 @@ BEGIN
|
|||
PUSHBUTTON "Help",ID_HELP,255,49,50,14
|
||||
END
|
||||
|
||||
IDD_CHECKCONFIRM_BOX DIALOG DISCARDABLE 0, 0, 186, 95
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Confirmation Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "",IDC_STATIC1,7,7,172,38
|
||||
CONTROL "",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,51,
|
||||
172,10
|
||||
DEFPUSHBUTTON "OK",IDOK,29,68,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,105,68,50,14
|
||||
END
|
||||
|
||||
IDD_SELECT_BOX DIALOG DISCARDABLE 0, 0, 192, 103
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "User Selection Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "",IDC_STATIC1,7,7,178,8
|
||||
LISTBOX IDC_LIST1,7,21,178,53,LBS_HASSTRINGS |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
DEFPUSHBUTTON "OK",IDOK,40,82,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,104,82,50,14
|
||||
END
|
||||
|
||||
IDD_PLUGIN_SPLASH DIALOG DISCARDABLE 0, 0, 259, 150
|
||||
STYLE DS_MODALFRAME | WS_POPUP
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -129,6 +129,8 @@
|
|||
#define IDD_NETWORK 135
|
||||
#define IDS_MAIL_SERVER 135
|
||||
#define IDC_ARROW_RIGHT 136
|
||||
#define IDD_CHECKCONFIRM_BOX 136
|
||||
#define IDD_SELECT_BOX 137
|
||||
#define IDD_USERPASS 140
|
||||
#define IDS_HELP_BUTTON 140
|
||||
#define IDD_MAILURL 141
|
||||
|
@ -2575,6 +2577,7 @@
|
|||
#define ID_PRIVACY_DISPLAY_SIGNONS 35109
|
||||
#define ID_PRIVACY_DISPLAY_RECEIPTS 35110
|
||||
#define ID_PRIVACY_DISPLAY_TUTORIAL 35111
|
||||
#define ID_PRIVACY_DISPLAY_SITEINFO 35112
|
||||
|
||||
#define ID_EDT_FILE_SAVE 42001
|
||||
#define ID_EDT_FILE_SAVEAS 42002
|
||||
|
|
|
@ -680,6 +680,15 @@ BOOL FE_FileType(char * path,
|
|||
(*context->funcs->PromptPassword)(context, Msg)
|
||||
#define FE_PromptUsernameAndPassword(cx, Msg, username, password) \
|
||||
(*cx->funcs->PromptUsernameAndPassword)(cx,Msg,username,password)
|
||||
|
||||
#ifdef XP_WIN /* privacy ifdef - last person to get here please remove */
|
||||
#define FE_CheckConfirm(context,msg,checkmsg,okmsg,cancelmsg,checked) \
|
||||
(*context->funcs->CheckConfirm)(context,msg,checkmsg,okmsg,cancelmsg,checked)
|
||||
|
||||
#define FE_SelectDialog(context,msg,list,count) \
|
||||
(*context->funcs->SelectDialog)(context,msg,list,count)
|
||||
#endif
|
||||
|
||||
#define FE_EnableClicking(context) \
|
||||
(*context->funcs->EnableClicking)(context)
|
||||
#define FE_GetDefaultBackgroundColor(context,color) \
|
||||
|
|
|
@ -458,6 +458,12 @@ extern JSBool
|
|||
ET_PostMessageBox(MWContext* context, char* szMessage,
|
||||
JSBool bConfirm);
|
||||
|
||||
JSBool
|
||||
ET_PostCheckConfirmBox(MWContext* context,
|
||||
char* szMainMessage, char* szCheckMessage,
|
||||
char* szOKMessage, char* szCancelMessage,
|
||||
JSBool *bChecked);
|
||||
|
||||
extern void
|
||||
ET_PostProgress(MWContext* context, const char* szMessage);
|
||||
|
||||
|
|
|
@ -135,6 +135,10 @@ FE_DEFINE(UseFancyNewsgroupListing, XP_Bool, (MWContext *window_id))
|
|||
FE_DEFINE(FileSortMethod, int, (MWContext * window_id))
|
||||
FE_DEFINE(ShowAllNewsArticles, XP_Bool, (MWContext *window_id))
|
||||
FE_DEFINE(Confirm, XP_Bool,(MWContext * context, const char * Msg))
|
||||
#ifdef XP_WIN /* privacy ifdef - last person to get here, please remove */
|
||||
FE_DEFINE(CheckConfirm, XP_Bool, (MWContext *pContext, const char *pConfirmMessage, const char *pCheckMessage, const char *pOKMessage, const char *pCancelMessage, XP_Bool *pChecked))
|
||||
FE_DEFINE(SelectDialog, XP_Bool, (MWContext *pContext, const char *pMessage, const char **pList, int *pCount))
|
||||
#endif
|
||||
FE_DEFINE(Prompt,char*,(MWContext * context, const char * Msg, const char * dflt))
|
||||
FE_DEFINE(PromptWithCaption,char*,(MWContext * context, const char *caption, const char * Msg, const char * dflt))
|
||||
FE_DEFINE(PromptUsernameAndPassword, XP_Bool, (MWContext *,const char *,char **, char **))
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
#define IL_CLIENT
|
||||
#include "libimg.h" /* Image Library public API. */
|
||||
|
||||
#define CHECKBOX_ACCEPTBIT 0x01
|
||||
#define CHECKBOX_CHECKBIT 0x02
|
||||
|
||||
/* pointer to the mocha thread */
|
||||
extern PRThread *lm_InterpretThread;
|
||||
extern PRThread *mozilla_thread;
|
||||
|
@ -109,6 +112,16 @@ typedef struct {
|
|||
JSBool bConfirm; /* TRUE if confirmation, FALSE if alert */
|
||||
} MozillaEvent_MessageBox;
|
||||
|
||||
typedef struct {
|
||||
ETEvent ce;
|
||||
char* mainMessage,
|
||||
* checkMessage,
|
||||
* okMessage,
|
||||
* cancelMessage;
|
||||
JSBool accepted, /* dialog was OKed? */
|
||||
checked; /* checkbox is checked? */
|
||||
} MozillaEvent_CheckConfirmBox; /* CheckConfirm message box event */
|
||||
|
||||
|
||||
PR_STATIC_CALLBACK(void*)
|
||||
et_HandleEvent_MessageBox(MozillaEvent_MessageBox* e)
|
||||
|
@ -140,6 +153,44 @@ et_DestroyEvent_MessageBox(MozillaEvent_MessageBox* event)
|
|||
XP_FREE(event);
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(void*)
|
||||
et_HandleEvent_CheckConfirmBox(MozillaEvent_CheckConfirmBox* e)
|
||||
{
|
||||
void *pRet;
|
||||
Bool bPriorJSCalling = FALSE;
|
||||
if( e->ce.context ) {
|
||||
bPriorJSCalling = e->ce.context->bJavaScriptCalling;
|
||||
e->ce.context->bJavaScriptCalling = TRUE;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN /* privacy ifdef - last person to get here please remove */
|
||||
e->accepted = FE_CheckConfirm(e->ce.context, e->mainMessage,
|
||||
e->checkMessage, e->okMessage, e->cancelMessage,
|
||||
&e->checked);
|
||||
#else
|
||||
e->accepted = 0; /* and kill this else clause while you're at it */
|
||||
#endif
|
||||
/* we're restricted to a single (void *) return value, and we need to return
|
||||
two separate booleans, thus the bit hackery: */
|
||||
pRet = (void *) ((e->accepted ? CHECKBOX_ACCEPTBIT : 0x0) |
|
||||
(e->checked ? CHECKBOX_CHECKBIT : 0x0));
|
||||
|
||||
if( e->ce.context )
|
||||
e->ce.context->bJavaScriptCalling = bPriorJSCalling;
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(void)
|
||||
et_DestroyEvent_CheckConfirmBox(MozillaEvent_CheckConfirmBox* event)
|
||||
{
|
||||
XP_FREE((char *)event->mainMessage);
|
||||
XP_FREE((void *)event->checkMessage);
|
||||
XP_FREEIF((void *)event->okMessage);
|
||||
XP_FREEIF((void *)event->cancelMessage);
|
||||
XP_FREE((void *)event);
|
||||
}
|
||||
|
||||
JSBool
|
||||
ET_PostMessageBox(MWContext* context, char* szMessage, JSBool bConfirm)
|
||||
{
|
||||
|
@ -159,6 +210,30 @@ ET_PostMessageBox(MWContext* context, char* szMessage, JSBool bConfirm)
|
|||
|
||||
}
|
||||
|
||||
JSBool
|
||||
ET_PostCheckConfirmBox(MWContext* context,
|
||||
char* szMainMessage, char* szCheckMessage,
|
||||
char* szOKMessage, char* szCancelMessage,
|
||||
JSBool *bChecked)
|
||||
{
|
||||
uint8 rtnVal;
|
||||
MozillaEvent_CheckConfirmBox* event = PR_NEW(MozillaEvent_CheckConfirmBox);
|
||||
if (event == NULL)
|
||||
return JS_FALSE;
|
||||
event->ce.context = context;
|
||||
event->mainMessage = strdup(szMainMessage);
|
||||
event->checkMessage = szCheckMessage ? strdup(szCheckMessage) : 0;
|
||||
event->okMessage = szOKMessage ? strdup(szOKMessage) : 0;
|
||||
event->cancelMessage = strdup(szCancelMessage);
|
||||
event->checked = *bChecked;
|
||||
PR_InitEvent(&event->ce.event, context,
|
||||
(PRHandleEventProc)et_HandleEvent_CheckConfirmBox,
|
||||
(PRDestroyEventProc)et_DestroyEvent_CheckConfirmBox);
|
||||
rtnVal = (uint8) et_PostEvent(&event->ce, TRUE);
|
||||
*bChecked = (rtnVal & CHECKBOX_CHECKBIT) ? JS_TRUE : JS_FALSE;
|
||||
return (JSBool) (rtnVal & CHECKBOX_ACCEPTBIT) ? JS_TRUE : JS_FALSE;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -67,6 +67,8 @@ void PSFE_ShowAllNewsArticles () {}
|
|||
void PSFE_GraphProgressDestroy () {}
|
||||
void TXFE_Confirm () {}
|
||||
void TXFE_Alert () {}
|
||||
void TXFE_CheckConfirm () {}
|
||||
void TXFE_SelectDialog () {}
|
||||
void TXFE_GraphProgressDestroy () {}
|
||||
void TXFE_Progress () {}
|
||||
void TXFE_Prompt () {}
|
||||
|
|
|
@ -55,6 +55,7 @@ static PRThread * signon_lock_owner = NULL;
|
|||
static int signon_lock_count = 0;
|
||||
static Bool si_anonymous = FALSE;
|
||||
|
||||
#ifndef XP_WIN /* privacy ifdef - last person to get here please remove */
|
||||
/*
|
||||
* temporary UI until FE implements this function as a single dialog box
|
||||
*/
|
||||
|
@ -69,6 +70,7 @@ PRIVATE XP_Bool FE_CheckConfirm (
|
|||
return userHasAccepted;
|
||||
}
|
||||
/* end of temporary UI */
|
||||
#endif
|
||||
|
||||
PRIVATE void
|
||||
si_lock_signon_list(void)
|
||||
|
@ -454,10 +456,11 @@ si_CheckForUser(char *URLName, char *userName) {
|
|||
return FALSE; /* user not found */
|
||||
}
|
||||
|
||||
#ifndef XP_WIN /* privacy ifdef - last person to get here please remove */
|
||||
/*
|
||||
* temporary UI until FE implements this function as a single dialog box
|
||||
*/
|
||||
XP_Bool FE_Select(
|
||||
XP_Bool FE_SelectDialog(
|
||||
MWContext* pContext,
|
||||
char* pMessage,
|
||||
char** pList,
|
||||
|
@ -480,6 +483,7 @@ XP_Bool FE_Select(
|
|||
XP_FREE(message);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Get the user node for a given URL
|
||||
|
@ -548,7 +552,7 @@ si_GetUser(MWContext *context, char* URLName, Bool pickFirstUser) {
|
|||
}
|
||||
|
||||
/* have user select an item from the list */
|
||||
if (FE_Select(context, caption, list, &user_count)) {
|
||||
if (FE_SelectDialog(context, caption, list, &user_count)) {
|
||||
/* user selected an item */
|
||||
user = users[user_count]; /* this is the selected item */
|
||||
URL->chosen_user = user;
|
||||
|
@ -763,6 +767,7 @@ si_OkToSave(MWContext *context, char *URLName, char *userName) {
|
|||
if (!FE_CheckConfirm(context,
|
||||
XP_GetString(MK_SIGNON_NAG),
|
||||
XP_GetString(MK_SIGNON_REMEMBER),
|
||||
0,0,
|
||||
&remember_checked)) {
|
||||
if (remember_checked) {
|
||||
si_PutReject(strippedURLName, userName, TRUE);
|
||||
|
|
|
@ -1735,6 +1735,7 @@ net_AddCookiePermission
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef XP_WIN /* privacy ifdef - last person to get here please remove */
|
||||
/*
|
||||
* temporary UI until FE implements this function as a single dialog box
|
||||
*/
|
||||
|
@ -1742,6 +1743,8 @@ XP_Bool FE_CheckConfirm (
|
|||
MWContext *pContext,
|
||||
char* pConfirmMessage,
|
||||
char* pCheckMessage,
|
||||
char* pOKMessage,
|
||||
char* pCancelMessage,
|
||||
XP_Bool* pChecked) {
|
||||
|
||||
Bool userHasAccepted = ET_PostMessageBox(pContext, pConfirmMessage, TRUE);
|
||||
|
@ -1749,6 +1752,7 @@ XP_Bool FE_CheckConfirm (
|
|||
return userHasAccepted;
|
||||
}
|
||||
/* end of temporary UI */
|
||||
#endif
|
||||
|
||||
/* Java script is calling NET_SetCookieString, netlib is calling
|
||||
** this via NET_SetCookieStringFromHttp.
|
||||
|
@ -2163,10 +2167,15 @@ net_IntSetCookieString(MWContext * context,
|
|||
|
||||
{
|
||||
Bool old_cookie_remember_checked = cookie_remember_checked;
|
||||
#ifdef XP_WIN /* privacy ifdef - last person to get here please remove */
|
||||
XP_Bool userHasAccepted = ET_PostCheckConfirmBox
|
||||
#else
|
||||
XP_Bool userHasAccepted = FE_CheckConfirm
|
||||
#endif
|
||||
(context,
|
||||
new_string,
|
||||
remember_string,
|
||||
0,0,
|
||||
&cookie_remember_checked);
|
||||
PR_FREEIF(new_string);
|
||||
PR_FREEIF(remember_string);
|
||||
|
|
|
@ -46,12 +46,16 @@
|
|||
(MAIL_NEWS_TYPE(cp->type)))
|
||||
|
||||
|
||||
#ifndef XP_WIN /* privacy ifdef - last person to get here please remove */
|
||||
PRIVATE
|
||||
XP_Bool FE_CheckConfirm (
|
||||
MWContext *pContext,
|
||||
char* pConfirmMessage,
|
||||
char* pCheckMessage,
|
||||
char* pOKMessage,
|
||||
char* pCancelMessage,
|
||||
XP_Bool* pChecked);
|
||||
#endif
|
||||
|
||||
|
||||
PRIVATE int32
|
||||
|
@ -281,9 +285,9 @@ PRVCY_PrivacyPolicyConfirmSubmit(MWContext *ctxt,
|
|||
"will be used. If you are concerned by this, you may want to cancel\n"
|
||||
"this submission.\n",
|
||||
"Show this alert next time?",
|
||||
/* "Continue Submission",
|
||||
"Continue Submission",
|
||||
"Cancel Submission",
|
||||
TRUE, */
|
||||
/* TRUE, */
|
||||
&value);
|
||||
if (value != savevalue)
|
||||
{
|
||||
|
@ -342,6 +346,7 @@ PRVCY_IsAnonymous() {
|
|||
return anonymous;
|
||||
}
|
||||
|
||||
#ifndef XP_WIN /* privacy ifdef - last person to get here please remove */
|
||||
/*
|
||||
* temporary UI until FE implements this function as a single dialog box
|
||||
*/
|
||||
|
@ -350,6 +355,8 @@ XP_Bool FE_CheckConfirm (
|
|||
MWContext *pContext,
|
||||
char* pConfirmMessage,
|
||||
char* pCheckMessage,
|
||||
char* pOKMessage,
|
||||
char* pCancelMessage,
|
||||
XP_Bool* pChecked) {
|
||||
|
||||
Bool result = ET_PostMessageBox(pContext, pConfirmMessage, TRUE);
|
||||
|
@ -357,3 +364,4 @@ XP_Bool FE_CheckConfirm (
|
|||
return result;
|
||||
}
|
||||
/* end of temporary UI */
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче