From e7329e11299f8e546a33f5a0fb5be0b147c21d59 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sun, 9 Dec 2012 14:10:58 +0100 Subject: [PATCH] Do not uses windom functions for the login dialog. --- atari/login.c | 80 +++++++++++------------------------------- atari/res/netsurf.rsc | Bin 35788 -> 35788 bytes atari/res/netsurf.rsm | 4 +-- 3 files changed, 23 insertions(+), 61 deletions(-) diff --git a/atari/login.c b/atari/login.c index ddcfeba43..0fad4cd60 100755 --- a/atari/login.c +++ b/atari/login.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include "utils/config.h" #include "content/content.h" #include "content/hlcache.h" @@ -36,77 +36,39 @@ #include "utils/url.h" #include "content/urldb.h" #include "content/fetch.h" +#include "atari/misc.h" #include "atari/login.h" #include "atari/res/netsurf.rsh" -extern void * h_gem_rsrc; - -bool login_form_do( nsurl * url, char * realm, char ** out ) +bool login_form_do(nsurl * url, char * realm, char ** out) { - OBJECT *tree, *newtree; - WINDOW * form; char user[255]; char pass[255]; - bool bres = false; - int res = 0; - const char * auth; - lwc_string * host = nsurl_get_component(url, NSURL_HOST); - assert(host != NULL); + //const char * auth; + short exit_obj = 0; + OBJECT * tree; - if( realm == NULL ){ - realm = (char*)"Secure Area"; - } - - int len = strlen(realm) + lwc_string_length(host) + 4; - char * title = malloc( len ); - strncpy(title, realm, len ); - strncpy(title, ": ", len-strlen(realm) ); - strncat(title, lwc_string_data(host), len-strlen(realm)+2 ); - - lwc_string_unref(host); - - auth = urldb_get_auth_details(url, realm); user[0] = 0; pass[0] = 0; - /* - TODO: use auth details if available: - if( auth == NULL ){ - } else { - - }*/ - - RsrcGaddr (h_gem_rsrc , R_TREE, LOGIN, &tree); - ObjcChange( OC_OBJC, tree, LOGIN_BT_LOGIN, 0, 0 ); - ObjcChange( OC_OBJC, tree, LOGIN_BT_ABORT, 0, 0 ); - ObjcString( tree, LOGIN_TB_USER, (char*)&user ); - ObjcString( tree, LOGIN_TB_PASSWORD, (char*)&pass ); - form = FormWindBegin( tree, (char *)title ); - res = -1; - while( res != LOGIN_BT_LOGIN && res != LOGIN_BT_ABORT ){ - res = FormWindDo( MU_MESAG ); - switch( res ){ - case LOGIN_BT_LOGIN: - bres = true; - break; + // TODO: use auth details for predefined login data + // auth = urldb_get_auth_details(url, realm); + tree = get_tree(LOGIN); - case LOGIN_BT_ABORT: - bres = false; - break; - } - } - - if( bres ) { - *out = malloc(strlen((char*)&user) + strlen((char*)&pass) + 2 ); - strcpy(*out, (char*)&user); - strcat(*out, ":"); - strcat(*out, (char*)&pass); + assert(tree != NULL); + + exit_obj = simple_mdial(tree, 0); + + if(exit_obj == LOGIN_BT_LOGIN) { + get_string(tree, LOGIN_TB_USER, user); + get_string(tree, LOGIN_TB_PASSWORD, pass); + int size = strlen((char*)&user) + strlen((char*)&pass) + 2 ; + *out = malloc(size); + snprintf(*out, size, "%s:%s", user, pass); } else { *out = NULL; } - - FormWindEnd( ); - free( title ); - return( bres ); + return((exit_obj == LOGIN_BT_LOGIN)); } + diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc index f911df9e952960d1345ac6063d24648157d7fd3c..6addf82607de59f2d284653c23b3ad77204919df 100755 GIT binary patch delta 42 wcmX>zo$1VUrVYF*lP@X?PgYP-1kv0K0g1)M<@rS^Rtl3Jsta!}Qi)0j08pzo$1VUrVYF*!twF(4rpMqf{LOX7IB7v#Ny)e{Gt>qg~<=qg*O+eM5O}&GcFc% diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm index 649ea82e2..6c8e2e1c1 100755 --- a/atari/res/netsurf.rsm +++ b/atari/res/netsurf.rsm @@ -3,7 +3,7 @@ ResourceMaster v3.65 #N 99@32@AZAaza___ _@AZAaza090___ _@@_@ #FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@ #R 0@0@1@1@1@1@ -#M 20010100@0@7728@622@ +#M 20010100@0@7728@623@ #T 0@1@MAINMENU@@62@@ #O 4@32@T_FILE@@ #O 5@32@T_EDIT@@ @@ -198,4 +198,4 @@ ResourceMaster v3.65 #O 5@33@BT_DOWN_PIC@@ #O 6@25@BT_UP@@ #O 4@33@BT_UP_PIC@@ -#c 780@ +#c 32640@