diff options
author | Andras Timar <atimar@suse.com> | 2012-04-24 21:51:33 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-04-24 21:58:51 +0200 |
commit | 39bb77fd667f9d9fdaf374f3934b6eec7b7dc57a (patch) | |
tree | b7894f2a124c93147f7688c8b0df6702c3f6cfae /setup_native | |
parent | d8f145d1ebe8836f559ba47a1978063d922c6294 (diff) |
fdo#46355 sort SelectionTree control of Custom Setup with a custom action
Although Microsoft says that SelectionTree control can publish a control
event only on Windows Server 2003 and above, the custom action seems to
be working under a fully patched Windows XP SP3. Maybe it fails silently
on older Windows XPs, not to mention Windows 2000. I did not test those.
Diffstat (limited to 'setup_native')
3 files changed, 40 insertions, 1 deletions
diff --git a/setup_native/source/win32/customactions/sellang/exports.dxp b/setup_native/source/win32/customactions/sellang/exports.dxp index cc6dd8d32e47..c8a622e2641c 100644 --- a/setup_native/source/win32/customactions/sellang/exports.dxp +++ b/setup_native/source/win32/customactions/sellang/exports.dxp @@ -1 +1,2 @@ SelectLanguage +SortTree diff --git a/setup_native/source/win32/customactions/sellang/makefile.mk b/setup_native/source/win32/customactions/sellang/makefile.mk index ffad814e3d74..862653e2c906 100644 --- a/setup_native/source/win32/customactions/sellang/makefile.mk +++ b/setup_native/source/win32/customactions/sellang/makefile.mk @@ -49,7 +49,8 @@ CFLAGS+=-D_STLP_USE_STATIC_LIB UWINAPILIB= SLOFILES = \ - $(SLO)$/sellang.obj + $(SLO)/sellang.obj \ + $(SLO)/sorttree.obj SHL1STDLIBS= \ $(KERNEL32LIB)\ diff --git a/setup_native/source/win32/customactions/sellang/sorttree.cxx b/setup_native/source/win32/customactions/sellang/sorttree.cxx new file mode 100644 index 000000000000..25c6c6d1d25c --- /dev/null +++ b/setup_native/source/win32/customactions/sellang/sorttree.cxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright 2012 LibreOffice contributors. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#include <commctrl.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +extern "C" UINT __stdcall SortTree(MSIHANDLE) +{ + // Sort items (languages) in SelectionTree control, fdo#46355 + + HWND hwndMSI = FindWindow(TEXT("MsiDialogCloseClass"), NULL); + HWND hwndTV = FindWindowEx(hwndMSI, NULL, TEXT("SysTreeView32"), NULL); + HTREEITEM treeRoot = TreeView_GetRoot(hwndTV); + HTREEITEM optional = TreeView_GetNextSibling(hwndTV, treeRoot); + HTREEITEM dicts = TreeView_GetChild(hwndTV, optional); + TreeView_SortChildren(hwndTV, dicts, TRUE); + HTREEITEM langs = TreeView_GetNextSibling(hwndTV, optional); + TreeView_SortChildren(hwndTV, langs, TRUE); + + return ERROR_SUCCESS; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |