|
|
|
@ -2,7 +2,6 @@
|
|
|
|
|
#define URIEL_NAVBACK 0x11 |
|
|
|
|
#define URIEL_NAVFWD 0x12 |
|
|
|
|
#define URIEL_THUMB 0x13 |
|
|
|
|
#define URIEL_DOWNLOAD 0x14 |
|
|
|
|
|
|
|
|
|
#define URIEL_DL_PATH "::/Home/Downloads/" |
|
|
|
|
#define URIEL_THUMB_BMP "/Tmp/UrielThumb.bmp" |
|
|
|
@ -54,6 +53,10 @@ U0 U_InsertThumb(U8 *anchor, U8 *indent, U8 *outdent, U8 *url)
|
|
|
|
|
|
|
|
|
|
U0 U_Browser(U8 *url) |
|
|
|
|
{ |
|
|
|
|
Bool savefile=FALSE; |
|
|
|
|
U8 localfile[StrLen(URIEL_DL_PATH)+28]; |
|
|
|
|
U8 msg[128]; |
|
|
|
|
U8 savemsg[1024]; |
|
|
|
|
I64 size; |
|
|
|
|
U8 *cmd; |
|
|
|
|
ZeroParamBuf; |
|
|
|
@ -67,22 +70,56 @@ U0 U_Browser(U8 *url)
|
|
|
|
|
PopUpOk("Bad URL."); |
|
|
|
|
return; |
|
|
|
|
}; |
|
|
|
|
BlkRead(HGBD,HGFS_BUF,1,(size/BLK_SIZE)+1); |
|
|
|
|
MemSetU8(ToI64(HGFS_BUF)+size, 0x0, 1); |
|
|
|
|
DocClear; |
|
|
|
|
DocPutS(DocPut,HGFS_BUF); |
|
|
|
|
DocTop; |
|
|
|
|
if (URIEL_INSTANCE==FALSE) { |
|
|
|
|
StrCpy(Fs->task_title, HGBD_PARAM_BUF+128); |
|
|
|
|
URIEL_INSTANCE=TRUE; |
|
|
|
|
while (TRUE) { |
|
|
|
|
cmd = GetStr; |
|
|
|
|
if (StrCmp(cmd,"x")==0) { break; }; |
|
|
|
|
if (StrCmp(HGBD_PARAM_BUF+128,"download://")==0) { |
|
|
|
|
StrCpy(localfile,URIEL_DL_PATH); |
|
|
|
|
if (StrLastOcc(url,"/")>0) { |
|
|
|
|
StrCpy(localfile+StrLen(localfile), StrLastOcc(url,"/")+1); |
|
|
|
|
} else { |
|
|
|
|
StrCpy(localfile+StrLen(localfile),url); |
|
|
|
|
}; |
|
|
|
|
StrCpy(savemsg,"Download file: "); |
|
|
|
|
if (StrLastOcc(url,"/")>0) { |
|
|
|
|
StrCpy(savemsg+StrLen(savemsg),StrLastOcc(url,"/")+1); |
|
|
|
|
} else { |
|
|
|
|
StrCpy(savemsg+StrLen(savemsg),url); |
|
|
|
|
}; |
|
|
|
|
StrCpy(savemsg+StrLen(savemsg)," ("); |
|
|
|
|
StrCpy(savemsg+StrLen(savemsg),HGBD_PARAM_BUF); |
|
|
|
|
StrCpy(savemsg+StrLen(savemsg)," bytes)"); |
|
|
|
|
savefile = PopUpCancelOk(savemsg); |
|
|
|
|
if (savefile==TRUE) { |
|
|
|
|
BlkRead(HGBD,HGFS_BUF,1,(size/BLK_SIZE)+1); |
|
|
|
|
if (StrCmp(localfile+StrLen(localfile)-2,".Z")==0) { |
|
|
|
|
U8 uzlocalfile[StrLen(URIEL_DL_PATH)+28]; |
|
|
|
|
MemCpy(uzlocalfile,localfile,StrLen(localfile)-2); |
|
|
|
|
uzlocalfile[StrLen(localfile)-1] = 0x0; |
|
|
|
|
FileWrite(uzlocalfile, HGFS_BUF, size); |
|
|
|
|
Move(uzlocalfile, localfile); |
|
|
|
|
} else { |
|
|
|
|
FileWrite(localfile, HGFS_BUF, size); |
|
|
|
|
}; |
|
|
|
|
StrCpy(msg, "Downloaded file: "); |
|
|
|
|
StrCpy(msg+StrLen(msg), localfile); |
|
|
|
|
PopUpOk(msg); |
|
|
|
|
}; |
|
|
|
|
Free(cmd); |
|
|
|
|
URIEL_INSTANCE=FALSE; |
|
|
|
|
} else { |
|
|
|
|
StrCpy(Fs->parent_task->task_title, HGBD_PARAM_BUF+128); |
|
|
|
|
BlkRead(HGBD,HGFS_BUF,1,(size/BLK_SIZE)+1); |
|
|
|
|
MemSetU8(ToI64(HGFS_BUF)+size, 0x0, 1); |
|
|
|
|
DocClear; |
|
|
|
|
DocPutS(DocPut,HGFS_BUF); |
|
|
|
|
DocTop; |
|
|
|
|
if (URIEL_INSTANCE==FALSE) { |
|
|
|
|
StrCpy(Fs->task_title, HGBD_PARAM_BUF+128); |
|
|
|
|
URIEL_INSTANCE=TRUE; |
|
|
|
|
while (TRUE) { |
|
|
|
|
cmd = GetStr; |
|
|
|
|
if (StrCmp(cmd,"x")==0) { break; }; |
|
|
|
|
}; |
|
|
|
|
Free(cmd); |
|
|
|
|
URIEL_INSTANCE=FALSE; |
|
|
|
|
} else { |
|
|
|
|
StrCpy(Fs->parent_task->task_title, HGBD_PARAM_BUF+128); |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -107,40 +144,6 @@ U0 U_HistNav(I64 index)
|
|
|
|
|
DocTop; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
U0 U_Download(U8 *url) |
|
|
|
|
{ |
|
|
|
|
I64 size; |
|
|
|
|
U8 localfile[StrLen(URIEL_DL_PATH)+28]; |
|
|
|
|
U8 msg[128]; |
|
|
|
|
StrCpy(localfile,URIEL_DL_PATH); |
|
|
|
|
if (StrLen(StrLastOcc(url,"/")+1)>0) { |
|
|
|
|
StrCpy(localfile+StrLen(localfile), StrLastOcc(url,"/")+1); |
|
|
|
|
} else { |
|
|
|
|
StrCpy(localfile+StrLen(localfile), "Download.OUT"); |
|
|
|
|
}; |
|
|
|
|
ZeroParamBuf; |
|
|
|
|
HGExec(URIEL_DOWNLOAD); |
|
|
|
|
ReadParamBuf; |
|
|
|
|
size = Str2I64(HGBD_PARAM_BUF); |
|
|
|
|
if (size==-1) { |
|
|
|
|
PopUpOk("Bad URL."); |
|
|
|
|
return; |
|
|
|
|
}; |
|
|
|
|
BlkRead(HGBD,HGFS_BUF,1,(size/BLK_SIZE)+1); |
|
|
|
|
if (StrCmp(localfile+StrLen(localfile)-2,".Z")==0) { |
|
|
|
|
U8 uzlocalfile[StrLen(URIEL_DL_PATH)+28]; |
|
|
|
|
MemCpy(uzlocalfile,localfile,StrLen(localfile)-2); |
|
|
|
|
uzlocalfile[StrLen(localfile)-1] = 0x0; |
|
|
|
|
FileWrite(uzlocalfile, HGFS_BUF, size); |
|
|
|
|
Move(uzlocalfile, localfile); |
|
|
|
|
} else { |
|
|
|
|
FileWrite(localfile, HGFS_BUF, size); |
|
|
|
|
}; |
|
|
|
|
StrCpy(msg, "Downloaded file: "); |
|
|
|
|
StrCpy(msg+StrLen(msg), localfile); |
|
|
|
|
PopUpOk(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
U0 U_Navigate(U8 *anchor, U8 *url) { |
|
|
|
|
DocAnchorFind(DocPut,anchor); |
|
|
|
|
U_Browser(url); |
|
|
|
|