This patch should at least mitigate the state of the bug 19182.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- programs/winecfg/resource.h | 1 + programs/winecfg/theme.c | 30 ++++++++++++++-- programs/winecfg/winecfg.rc | 40 ++++++++++++---------- programs/winemenubuilder/winemenubuilder.c | 23 ++++++++++++- 4 files changed, 73 insertions(+), 21 deletions(-)
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h index 0c0b038ff9..2760e92c00 100644 --- a/programs/winecfg/resource.h +++ b/programs/winecfg/resource.h @@ -176,6 +176,7 @@ #define IDC_SYSPARAM_COLOR_TEXT 1415 #define IDC_SYSPARAM_COLOR 1416 #define IDC_SYSPARAM_FONT 1417 +#define IDC_ENABLE_FILE_ASSOCIATIONS 1418
#define IDC_SYSPARAMS_BUTTON 8400 #define IDC_SYSPARAMS_BUTTON_TEXT 8401 diff --git a/programs/winecfg/theme.c b/programs/winecfg/theme.c index f98dcc3ae7..863bc6bb93 100644 --- a/programs/winecfg/theme.c +++ b/programs/winecfg/theme.c @@ -1168,6 +1168,26 @@ static void on_select_font(HWND hDlg) SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0); }
+static void init_mime_types(HWND hDlg) +{ + char *buf = get_reg_key(config_key, keypath("MIME-types"), "EnableFileAssociations", "Y"); + int state = IS_OPTION_TRUE(*buf) ? BST_CHECKED : BST_UNCHECKED; + + CheckDlgButton(hDlg, IDC_ENABLE_FILE_ASSOCIATIONS, state); + + HeapFree(GetProcessHeap(), 0, buf); +} + +static void update_mime_types(HWND hDlg) +{ + const char *state = "Y"; + + if (IsDlgButtonChecked(hDlg, IDC_ENABLE_FILE_ASSOCIATIONS) != BST_CHECKED) + state = "N"; + + set_reg_key(config_key, keypath("MIME-types"), "EnableFileAssociations", state); +} + INT_PTR CALLBACK ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -1177,8 +1197,9 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) init_shell_folder_listview_headers(hDlg); update_shell_folder_listview(hDlg); read_sysparams(hDlg); + init_mime_types(hDlg); break; - + case WM_DESTROY: free_theme_files(); break; @@ -1186,7 +1207,7 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_SHOWWINDOW: set_window_title(hDlg); break; - + case WM_COMMAND: switch(HIWORD(wParam)) { case CBN_SELCHANGE: { @@ -1296,6 +1317,10 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) } break; } + + case IDC_ENABLE_FILE_ASSOCIATIONS: + update_mime_types(hDlg); + break; } break; } @@ -1314,6 +1339,7 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) apply_sysparams(); read_shell_folder_link_targets(); update_shell_folder_listview(hDlg); + update_mime_types(hDlg); SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); break; } diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc index 5908b491d4..d37a55e9e6 100644 --- a/programs/winecfg/winecfg.rc +++ b/programs/winecfg/winecfg.rc @@ -284,25 +284,29 @@ IDD_DESKTOP_INTEGRATION DIALOG 0, 0, 260, 220 STYLE WS_CHILD | WS_DISABLED FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Appearance",IDC_STATIC,8,4,244,106 - LTEXT "&Theme:",IDC_STATIC,15,16,130,8 - COMBOBOX IDC_THEME_THEMECOMBO,15,26,130,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Install theme...",IDC_THEME_INSTALL,152,26,93,14 - LTEXT "&Color:",IDC_THEME_COLORTEXT,15,48,105,8 - COMBOBOX IDC_THEME_COLORCOMBO,15,58,105,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "&Size:",IDC_THEME_SIZETEXT,126,48,120,8 - COMBOBOX IDC_THEME_SIZECOMBO,126,58,120,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "It&em:",IDC_STATIC,15,80,105,8 - COMBOBOX IDC_SYSPARAM_COMBO,15,90,105,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "C&olor:",IDC_SYSPARAM_COLOR_TEXT,126,80,25,8,WS_DISABLED - PUSHBUTTON "",IDC_SYSPARAM_COLOR,126,90,25,13,WS_DISABLED | BS_OWNERDRAW - LTEXT "Si&ze:",IDC_SYSPARAM_SIZE_TEXT,157,80,30,8,WS_DISABLED - EDITTEXT IDC_SYSPARAM_SIZE,157,90,30,13,ES_AUTOHSCROLL | WS_TABSTOP | WS_DISABLED - CONTROL "",IDC_SYSPARAM_SIZE_UD,UPDOWN_CLASSA,UDS_SETBUDDYINT | UDS_ALIGNRIGHT | WS_DISABLED, 185,90,15,13 - PUSHBUTTON "&Font...",IDC_SYSPARAM_FONT,190,90,55,13,WS_DISABLED - GROUPBOX "Folders",IDC_STATIC,8,114,244,100 + GROUPBOX "Appearance",IDC_STATIC,8,4,244,90 + LTEXT "&Theme:",IDC_STATIC,15,15,130,8 + COMBOBOX IDC_THEME_THEMECOMBO,15,25,130,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Install theme...",IDC_THEME_INSTALL,152,25,93,13 + LTEXT "&Color:",IDC_THEME_COLORTEXT,15,40,105,8 + COMBOBOX IDC_THEME_COLORCOMBO,15,50,105,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Size:",IDC_THEME_SIZETEXT,126,40,120,8 + COMBOBOX IDC_THEME_SIZECOMBO,126,50,120,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "It&em:",IDC_STATIC,15,65,105,8 + COMBOBOX IDC_SYSPARAM_COMBO,15,75,105,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT + LTEXT "C&olor:",IDC_SYSPARAM_COLOR_TEXT,126,65,25,8,WS_DISABLED + PUSHBUTTON "",IDC_SYSPARAM_COLOR,126,75,25,13,WS_DISABLED | BS_OWNERDRAW + LTEXT "Si&ze:",IDC_SYSPARAM_SIZE_TEXT,157,65,30,8,WS_DISABLED + EDITTEXT IDC_SYSPARAM_SIZE,157,75,30,13,ES_AUTOHSCROLL | WS_TABSTOP | WS_DISABLED + CONTROL "",IDC_SYSPARAM_SIZE_UD,UPDOWN_CLASSA,UDS_SETBUDDYINT | UDS_ALIGNRIGHT | WS_DISABLED, 185,75,15,13 + + GROUPBOX "MIME types",IDC_STATIC,8,95,244,23 + CONTROL "Allow Wine to manage file &associations",IDC_ENABLE_FILE_ASSOCIATIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,105,230,8 + + PUSHBUTTON "&Font...",IDC_SYSPARAM_FONT,190,75,55,13,WS_DISABLED + GROUPBOX "Folders",IDC_STATIC,8,120,244,94 CONTROL "",IDC_LIST_SFPATHS,"SysListView32",LVS_REPORT | LVS_AUTOARRANGE | LVS_ALIGNLEFT | - LVS_SINGLESEL | WS_BORDER | WS_TABSTOP, 15,126,230,64 + LVS_SINGLESEL | WS_BORDER | WS_TABSTOP, 15,132,230,58 CONTROL "&Link to:",IDC_LINK_SFPATH,"Button",BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED,15,195,65,13 EDITTEXT IDC_EDIT_SFPATH,80,195,110,13,ES_AUTOHSCROLL|WS_TABSTOP|WS_DISABLED PUSHBUTTON "B&rowse...",IDC_BROWSE_SFPATH,195,195,50,13,WS_DISABLED diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 0013b04cee..dd69ff96da 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -104,6 +104,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(menubuilder); #define in_startmenu(csidl) ((csidl)==CSIDL_STARTMENU || \ (csidl)==CSIDL_COMMON_STARTMENU)
+#define IS_OPTION_TRUE(ch) \ + ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1') + /* link file formats */
#include "pshpack1.h" @@ -3619,6 +3622,23 @@ static BOOL init_xdg(void) return FALSE; }
+static BOOL associations_enabled(void) +{ + BOOL ret = TRUE; + HKEY hkey; + BYTE buf[32]; + DWORD len; + + if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\Wine\MIME-types", &hkey)) + { + len = sizeof(buf); + if (!RegQueryValueExA(hkey, "EnableFileAssociations", NULL, NULL, buf, &len)) + ret = IS_OPTION_TRUE(buf[0]); + } + + return ret; +} + /*********************************************************************** * * wWinMain @@ -3654,7 +3674,8 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sh break; if( !strcmpW( token, dash_aW ) ) { - RefreshFileTypeAssociations(); + if (associations_enabled()) + RefreshFileTypeAssociations(); continue; } if( !strcmpW( token, dash_rW ) )