summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2012-12-09 14:10:58 +0100
committerOle Loots <ole@monochrom.net>2012-12-09 14:10:58 +0100
commite7329e11299f8e546a33f5a0fb5be0b147c21d59 (patch)
tree1eab9eb0a5ee0fbbac71ea192e30ff5c1d486d6d
parentec0c68503df1492bf35aad3a9f7ea55f3eee0721 (diff)
downloadnetsurf-e7329e11299f8e546a33f5a0fb5be0b147c21d59.tar.gz
netsurf-e7329e11299f8e546a33f5a0fb5be0b147c21d59.tar.bz2
Do not uses windom functions for the login dialog.
-rwxr-xr-xatari/login.c80
-rwxr-xr-xatari/res/netsurf.rscbin35788 -> 35788 bytes
-rwxr-xr-xatari/res/netsurf.rsm4
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 <stdlib.h>
#include <string.h>
#include <stdbool.h>
-#include <windom.h>
+#include <cflib.h>
#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);
-
- if( realm == NULL ){
- realm = (char*)"Secure Area";
- }
+ //const char * auth;
+ short exit_obj = 0;
+ OBJECT * tree;
- 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 f911df9e9..6addf8260 100755
--- a/atari/res/netsurf.rsc
+++ b/atari/res/netsurf.rsc
Binary files differ
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@