Index: winsup/cinstall/choose.cc =================================================================== RCS file: /cvs/src/src/winsup/cinstall/choose.cc,v retrieving revision 2.11 diff -u -p -r2.11 choose.cc --- choose.cc 2000/12/11 00:07:56 2.11 +++ choose.cc 2001/03/06 04:38:44 @@ -30,6 +30,7 @@ static char *cvsid = "\n%%% $Id: choose. #include "win32.h" #include #include +#include #include #include "dialog.h" @@ -41,7 +42,9 @@ static char *cvsid = "\n%%% $Id: choose. #include "log.h" #include "find.h" -#define HMARGIN 10 +#include "port.h" + +#define HMARGIN 10 #define ROW_MARGIN 5 #define ICON_MARGIN 4 @@ -54,6 +57,7 @@ static char *cvsid = "\n%%% $Id: choose. static int initialized = 0; static int full_list = 0; +static int which_trust = TRUST_CURR; static int scroll_ulc_x, scroll_ulc_y; @@ -180,6 +184,8 @@ paint (HWND hwnd) if (nindexes == 0) { static char *msg = "Nothing to Install/Update"; + if (source == IDC_SOURCE_DOWNLOAD) + msg = "Nothing to Download"; TextOut (hdc, HMARGIN, header_height, msg, strlen (msg)); } @@ -280,13 +286,20 @@ list_click (HWND hwnd, BOOL dblclk, int if (x >= headers[NEW_COL].x - HMARGIN/2 && x <= headers[NEW_COL+1].x - HMARGIN/2) { extra[p].pick ++; + while (extra[p].chooser[extra[p].pick].trust < NTRUST && + (package[p].info[extra[p].chooser[extra[p].pick].trust].install_exists + ==0 && source == IDC_SOURCE_CWD) && + package[p].info[extra[p].chooser[extra[p].pick].trust].install && + extra[p].chooser[extra[p].pick].caption != 0) + extra[p].pick ++; if (extra[p].chooser[extra[p].pick].caption == 0) extra[p].pick = 0; } if (x >= headers[SRC_COL].x - HMARGIN/2 && x <= headers[SRC_COL+1].x - HMARGIN/2) { - if (extra[p].chooser[extra[p].pick].src_avail) + if (extra[p].chooser[extra[p].pick].src_avail && + package[p].info[extra[p].chooser[extra[p].pick].trust].source_exists) package[p].srcaction ^= (SRCACTION_NO^SRCACTION_YES); } @@ -350,17 +363,77 @@ note_width (HDC dc, char *string, int ad headers[column].width = s.cx + addend; } +static int +check_existence (int p, int trust, int check_src) +{ + if (source == IDC_SOURCE_NETINST) + return 1; + if (source == IDC_SOURCE_DOWNLOAD) + { + if ( check_src == 0 && _access(package[p].info[trust].install,0) == 0) + return 1; + else if ( check_src == 1 && _access(package[p].info[trust].source,0) == 0 ) + return 1; + else + return 0; + } + if (source == IDC_SOURCE_CWD) + { + if ( check_src == 0 && package[p].info[trust].install && + _access(package[p].info[trust].install,0) == 0 ) + return 1; + else if ( check_src == 1 && package[p].info[trust].source && + _access(package[p].info[trust].source,0) == 0 ) + return 1; + } + return 0; +} + +static void +set_existence () +{ + for (int i=0; i=0; t--) - if (package[p].info[t].install) + t=trust; + if (package[p].info[t].install && + ((package[p].info[t].install_exists && source == IDC_SOURCE_CWD) || + (package[p].info[t].install_exists == 0 && + source == IDC_SOURCE_DOWNLOAD) || source == IDC_SOURCE_NETINST)) return t; - for (t=trust+1; t<=NTRUST; t++) - if (package[p].info[t].install) - return t; - if (extra[p].installed_file) + if (extra[p].installed_file && extra[p].installed_ver == package[p].info[t].version) return TRUST_KEEP; return TRUST_NONE; } @@ -370,10 +443,13 @@ default_trust (HWND h, int trust) { int i, t, c; + which_trust=trust; + for (i=0; i=NTRUST-1) + if (!package[i].info[TRUST_CURR].install) + { + package[i].info[TRUST_CURR].version = 0; + package[i].info[TRUST_CURR].install = strdup(path); + package[i].info[TRUST_CURR].install_size = size; + package[i].info[TRUST_CURR].install_exists=1; + if (package[i].info[TRUST_CURR].version == 0) + get_package_version(i,TRUST_CURR); + break; + } + else if (!package[i].info[TRUST_PREV].install ) + { + package[i].info[TRUST_PREV].version = 0; + package[i].info[TRUST_PREV].install = strdup(path); + package[i].info[TRUST_PREV].install_size = size; + package[i].info[TRUST_PREV].install_exists=1; + if (package[i].info[TRUST_PREV].version == 0) + get_package_version(i,TRUST_PREV); + break; + } + break; + } + } + } } static void @@ -684,6 +861,7 @@ read_installed_db () int t; extra[i].installed_file = inst; extra[i].installed_size = instsz; + get_package_version(i, -1); for (t=0; t",IDOK,175,185,45,15 PUSHBUTTON "Cancel",IDCANCEL,240,185,45,15 PUSHBUTTON "<-- &Back",IDC_BACK,130,185,45,15