Fixed prompt and password dialogs. [not part of build]

This commit is contained in:
vidur%netscape.com 2001-11-30 01:59:01 +00:00
Родитель 405859fe7e
Коммит 1ad0ca5c26
5 изменённых файлов: 90 добавлений и 45 удалений

Просмотреть файл

@ -18,19 +18,19 @@
confirmPanel = id;
confirmPanelText = id;
owner = id;
passwordCheck = id;
passwordInput = id;
passwordPanel = id;
passwordText = id;
passwordPanelCheck = id;
passwordPanelInput = id;
passwordPanelText = id;
promptPanel = id;
promptPanelCheck = id;
promptPanelInput = id;
promptPanelText = id;
usernameCheck = id;
usernamePanel = id;
usernamePasswordInput = id;
usernameText = id;
usernameUserNameInput = id;
usernamePanelCheck = id;
usernamePanelPassword = id;
usernamePanelText = id;
usernamePanelUserName = id;
};
SUPERCLASS = NSObject;
}

Двоичные данные
embedding/browser/cocoa/src/English.lproj/alert.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -36,7 +36,7 @@
- (void)alertCheck:(NSWindow*)parent title:(NSString*)title text:(NSString*)text checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue;
- (BOOL)confirm:(NSWindow*)parent title:(NSString*)title text:(NSString*)text;
- (BOOL)confirmCheck:(NSWindow*)parent title:(NSString*)title text:(NSString*)text checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue;
- (BOOL)prompt:(NSWindow*)parent title:(NSString*)title text:(NSString*)text promptText:(NSMutableString*)promptText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue;
- (BOOL)promptUserNameAndPassword:(NSWindow*)parent title:(NSString*)title text:(NSString*)text userNameText:(NSMutableString*)userNameText passwordText:(NSMutableString*)passwordText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue;
- (BOOL)promptPassword:(NSWindow*)parent title:(NSString*)title text:(NSString*)text passwordText:(NSMutableString*)passwordText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue;
- (BOOL)prompt:(NSWindow*)parent title:(NSString*)title text:(NSString*)text promptText:(NSMutableString*)promptText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue doCheck:(BOOL)doCheck;
- (BOOL)promptUserNameAndPassword:(NSWindow*)parent title:(NSString*)title text:(NSString*)text userNameText:(NSMutableString*)userNameText passwordText:(NSMutableString*)passwordText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue doCheck:(BOOL)doCheck;
- (BOOL)promptPassword:(NSWindow*)parent title:(NSString*)title text:(NSString*)text passwordText:(NSMutableString*)passwordText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue doCheck:(BOOL)doCheck;
@end

Просмотреть файл

@ -76,20 +76,26 @@
return (result == 1);
}
- (BOOL)prompt:(NSWindow*)parent title:(NSString*)title text:(NSString*)text promptText:(NSMutableString*)promptText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue
- (BOOL)prompt:(NSWindow*)parent title:(NSString*)title text:(NSString*)text promptText:(NSMutableString*)promptText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue doCheck:(BOOL)doCheck
{
[promptPanelText setStringValue:text];
[promptPanel setTitle:title];
int state = (*checkValue ? NSOnState : NSOffState);
[promptPanelCheck setState:state];
if (doCheck) {
int state = (*checkValue ? NSOnState : NSOffState);
[promptPanelCheck setState:state];
[promptPanelCheck setEnabled:YES];
}
else {
[promptPanelCheck setEnabled:NO];
}
[promptPanelCheck setTitle:checkMsg];
[promptPanelInput setTitle:promptText];
[promptPanelInput setStringValue:promptText];
int result = [NSApp runModalForWindow:promptPanel relativeToWindow:parent];
*checkValue = ([promptPanelCheck state] == NSOnState);
NSString* value = [promptPanelInput title];
NSString* value = [promptPanelInput stringValue];
PRUint32 length = [promptText length];
if (length) {
NSRange all;
@ -104,21 +110,27 @@
return (result == 1);
}
- (BOOL)promptUserNameAndPassword:(NSWindow*)parent title:(NSString*)title text:(NSString*)text userNameText:(NSMutableString*)userNameText passwordText:(NSMutableString*)passwordText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue
- (BOOL)promptUserNameAndPassword:(NSWindow*)parent title:(NSString*)title text:(NSString*)text userNameText:(NSMutableString*)userNameText passwordText:(NSMutableString*)passwordText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue doCheck:(BOOL)doCheck
{
[usernamePanelText setStringValue:text];
[usernamePanel setTitle:title];
int state = (*checkValue ? NSOnState : NSOffState);
[usernamePanelCheck setState:state];
if (doCheck) {
int state = (*checkValue ? NSOnState : NSOffState);
[usernamePanelCheck setState:state];
[usernamePanelCheck setEnabled:YES];
}
else {
[usernamePanelCheck setEnabled:NO];
}
[usernamePanelCheck setTitle:checkMsg];
[usernamePanelPassword setTitle:passwordText];
[usernamePanelUserName setTitle:userNameText];
[usernamePanelPassword setStringValue:passwordText];
[usernamePanelUserName setStringValue:userNameText];
int result = [NSApp runModalForWindow:usernamePanel relativeToWindow:parent];
*checkValue = ([usernamePanelCheck state] == NSOnState);
NSString* value = [usernamePanelUserName title];
NSString* value = [usernamePanelUserName stringValue];
PRUint32 length = [userNameText length];
if (length) {
NSRange all;
@ -128,7 +140,7 @@
}
[userNameText appendString:value];
value = [usernamePanelPassword title];
value = [usernamePanelPassword stringValue];
length = [passwordText length];
if (length) {
NSRange all;
@ -143,20 +155,26 @@
return (result == 1);
}
- (BOOL)promptPassword:(NSWindow*)parent title:(NSString*)title text:(NSString*)text passwordText:(NSMutableString*)passwordText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue
- (BOOL)promptPassword:(NSWindow*)parent title:(NSString*)title text:(NSString*)text passwordText:(NSMutableString*)passwordText checkMsg:(NSString*)checkMsg checkValue:(BOOL*)checkValue doCheck:(BOOL)doCheck
{
[passwordPanelText setStringValue:text];
[passwordPanel setTitle:title];
int state = (*checkValue ? NSOnState : NSOffState);
[passwordPanelCheck setState:state];
if (doCheck) {
int state = (*checkValue ? NSOnState : NSOffState);
[passwordPanelCheck setState:state];
[passwordPanelCheck setEnabled:YES];
}
else {
[passwordPanelCheck setEnabled:NO];
}
[passwordPanelCheck setTitle:checkMsg];
[passwordPanelInput setTitle:passwordText];
[passwordPanelInput setStringValue:passwordText];
int result = [NSApp runModalForWindow:passwordPanel relativeToWindow:parent];
*checkValue = ([passwordPanelCheck state] == NSOnState);
NSString* value = [passwordPanelInput title];
NSString* value = [passwordPanelInput stringValue];
PRUint32 length = [passwordText length];
if (length) {
NSRange all;

Просмотреть файл

@ -219,12 +219,18 @@ nsCocoaBrowserService::AlertCheck(nsIDOMWindow *parent,
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
BOOL valueBool = *checkValue ? YES : NO;
NSWindow* window = GetNSWindowForDOMWindow(parent);
[controller alertCheck:window title:titleStr text:textStr checkMsg:msgStr checkValue:&valueBool];
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
if (checkValue) {
BOOL valueBool = *checkValue ? YES : NO;
[controller alertCheck:window title:titleStr text:textStr checkMsg:msgStr checkValue:&valueBool];
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
}
else {
[controller alert:window title:titleStr text:textStr];
}
return NS_OK;
}
@ -266,12 +272,18 @@ nsCocoaBrowserService::ConfirmCheck(nsIDOMWindow *parent,
NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
BOOL valueBool = *checkValue ? YES : NO;
NSWindow* window = GetNSWindowForDOMWindow(parent);
*_retval = (PRBool)[controller confirmCheck:window title:titleStr text:textStr checkMsg:msgStr checkValue:&valueBool];
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
if (checkValue) {
BOOL valueBool = *checkValue ? YES : NO;
*_retval = (PRBool)[controller confirmCheck:window title:titleStr text:textStr checkMsg:msgStr checkValue:&valueBool];
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
}
else {
*_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
}
return NS_OK;
}
@ -311,12 +323,17 @@ nsCocoaBrowserService::Prompt(nsIDOMWindow *parent,
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
NSMutableString* valueStr = [NSMutableString stringWithCharacters:*value length:(*value ? nsCRT::strlen(*value) : 0)];
BOOL valueBool = *checkValue ? YES : NO;
BOOL valueBool;
if (checkValue) {
valueBool = *checkValue ? YES : NO;
}
NSWindow* window = GetNSWindowForDOMWindow(parent);
*_retval = (PRBool)[controller prompt:window title:titleStr text:textStr promptText:valueStr checkMsg:msgStr checkValue:&valueBool];
*_retval = (PRBool)[controller prompt:window title:titleStr text:textStr promptText:valueStr checkMsg:msgStr checkValue:&valueBool doCheck:(checkValue != nsnull)];
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
if (checkValue) {
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
}
PRUint32 length = [valueStr length];
PRUnichar* retStr = (PRUnichar*)nsMemory::Alloc((length + 1) * sizeof(PRUnichar));
[valueStr getCharacters:retStr];
@ -348,12 +365,17 @@ nsCocoaBrowserService::PromptUsernameAndPassword(nsIDOMWindow *parent,
NSMutableString* userNameStr = [NSMutableString stringWithCharacters:*username length:(*username ? nsCRT::strlen(*username) : 0)];
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
BOOL valueBool = *checkValue ? YES : NO;
BOOL valueBool;
if (checkValue) {
valueBool = *checkValue ? YES : NO;
}
NSWindow* window = GetNSWindowForDOMWindow(parent);
*_retval = (PRBool)[controller promptUserNameAndPassword:window title:titleStr text:textStr userNameText:userNameStr passwordText:passwordStr checkMsg:msgStr checkValue:&valueBool];
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
*_retval = (PRBool)[controller promptUserNameAndPassword:window title:titleStr text:textStr userNameText:userNameStr passwordText:passwordStr checkMsg:msgStr checkValue:&valueBool doCheck:(checkValue != nsnull)];
if (checkValue) {
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
}
PRUint32 length = [userNameStr length];
PRUnichar* retStr = (PRUnichar*)nsMemory::Alloc((length + 1) * sizeof(PRUnichar));
@ -390,12 +412,17 @@ nsCocoaBrowserService::PromptPassword(nsIDOMWindow *parent,
NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
BOOL valueBool = *checkValue ? YES : NO;
BOOL valueBool;
if (checkValue) {
valueBool = *checkValue ? YES : NO;
}
NSWindow* window = GetNSWindowForDOMWindow(parent);
*_retval = (PRBool)[controller promptPassword:window title:titleStr text:textStr passwordText:passwordStr checkMsg:msgStr checkValue:&valueBool];
*_retval = (PRBool)[controller promptPassword:window title:titleStr text:textStr passwordText:passwordStr checkMsg:msgStr checkValue:&valueBool doCheck:(checkValue != nsnull)];
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
if (checkValue) {
*checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
}
PRUint32 length = [passwordStr length];
PRUnichar* retStr = (PRUnichar*)nsMemory::Alloc((length + 1) * sizeof(PRUnichar));