Index: src/af/xap/win/xap_Win32Resources.rc2 =================================================================== RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Resources.rc2,v retrieving revision 1.6 diff -u -r1.6 xap_Win32Resources.rc2 --- src/af/xap/win/xap_Win32Resources.rc2 2000/07/09 22:04:29 1.6 +++ src/af/xap/win/xap_Win32Resources.rc2 2000/07/24 20:26:52 @@ -27,12 +27,14 @@ // ////////////////////////////////////////////////////////////////// -#define XAP_RID_DIALOG_WINDOWMORE 100 -#define XAP_RID_DIALOG_ZOOM 101 +#define XAP_RID_DIALOG_WINDOWMORE 100 +#define XAP_RID_DIALOG_ZOOM 101 #define XAP_RID_DIALOG_INSERT_SYMBOL 102 #define XAP_RID_DIALOG_INSERT_PICTURE 103 +#define XAP_RID_DIALOG_FILETYPEPROMPT 104 #include "xap_Win32Res_DlgWindowMore.rc2" #include "xap_Win32Res_DlgZoom.rc2" #include "xap_Win32Res_DlgInsertSymbol.rc2" #include "xap_Win32Res_DlgInsertPicture.rc2" +#include "xap_Win32Res_DlgFiletypePrompt.rc2" Index: src/af/xap/win/xap_Win32Slurp.cpp =================================================================== RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Slurp.cpp,v retrieving revision 1.10 diff -u -r1.10 xap_Win32Slurp.cpp --- src/af/xap/win/xap_Win32Slurp.cpp 2000/05/26 21:24:49 1.10 +++ src/af/xap/win/xap_Win32Slurp.cpp 2000/07/24 20:26:52 @@ -31,6 +31,7 @@ #include "xap_Win32App.h" #include "xap_Win32Slurp.h" #include "xap_Prefs.h" +#include "xap_Win32Resources.rc2" ////////////////////////////////////////////////////////////////// // "Slurp" (aka "Leech") refers to the ability of an application @@ -479,7 +480,7 @@ else { - if (!_askForUpdateExePathname()) + if (!_askForUpdateExePathname(buf, szExePathname, szContentType)) goto CleanupMess; } } @@ -663,16 +664,41 @@ return bResult; } -UT_Bool XAP_Win32Slurp::_askForUpdateExePathname(void) const -{ - // TODO install a real dialog that asks the user if - // TODO we want to change the pathname of the exe in - // TODO the association and to set preference values - // TODO to never asking again or always set it or - // TODO whatever... - - UT_DEBUGMSG(("Registry: Need to update EXE pathname...\n")); - UT_Bool bResult = UT_FALSE; +BOOL CALLBACK dialogCallback(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + SetDlgItemText(hwndDlg, XAP_RID_DIALOG_FILETYPEPROMPT_TEXT_EXPLANATION, (const char *)lParam); + } + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDYES: + EndDialog(hwndDlg, wParam); + return TRUE; + case IDNO: + if (IsDlgButtonChecked(hwndDlg, XAP_RID_DIALOG_FILETYPEPROMPT_CHECKBOX)) + UT_DEBUGMSG(("The Never Ask checkbox was checked.\n")); + else + UT_DEBUGMSG(("The Never Ask checkbox was not checked.\n")); + + EndDialog(hwndDlg, wParam); + return FALSE; + } + } + return FALSE; +} + +UT_Bool XAP_Win32Slurp::_askForUpdateExePathname(const char * oldpath, const char * newpath, const char* contenttype) const +{ + char tmpstring[500]; + sprintf(tmpstring, "The file type \"%s\" is registered to be opened by the program\n%s,\n but you are running the program\n%s\nWould you like to change the default handler?", contenttype, oldpath, newpath); + DialogBoxParam(NULL, MAKEINTRESOURCE(XAP_RID_DIALOG_FILETYPEPROMPT), NULL, (DLGPROC)dialogCallback, (LPARAM)tmpstring); + + UT_DEBUGMSG(("Registry: Need to update EXE pathname...\n")); + UT_Bool bResult = UT_FALSE; return bResult; } Index: src/af/xap/win/xap_Win32Slurp.h =================================================================== RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Slurp.h,v retrieving revision 1.3 diff -u -r1.3 xap_Win32Slurp.h --- src/af/xap/win/xap_Win32Slurp.h 1999/05/14 17:14:40 1.3 +++ src/af/xap/win/xap_Win32Slurp.h 2000/07/24 20:26:52 @@ -40,7 +40,7 @@ protected: UT_Bool _askForStealFromAnotherApplication(void) const; - UT_Bool _askForUpdateExePathname(void) const; + UT_Bool _askForUpdateExePathname(const char * oldpath, const char * newpath, const char * contenttype) const; UT_Bool _askForStealMimeFromAnotherApplication(void) const; XAP_Win32App * m_pApp;