From 393d16a67f34a9f697e80619086a8493d681b796 Mon Sep 17 00:00:00 2001 From: Jonathan Ernst Date: Fri, 11 Mar 2005 10:26:41 +0000 Subject: [PATCH] Add search field with find-as-you-type function. --- programs/uninstaller/En.rc | 3 ++- programs/uninstaller/Makefile.in | 2 +- programs/uninstaller/main.c | 24 +++++++++++++++++++++--- programs/uninstaller/rsrc.rc | 2 +- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/programs/uninstaller/En.rc b/programs/uninstaller/En.rc index a85ee961868..afc8488fbdc 100644 --- a/programs/uninstaller/En.rc +++ b/programs/uninstaller/En.rc @@ -26,6 +26,7 @@ CAPTION "Wine Application Uninstaller" FONT 10, "MS Sans Serif" BEGIN LTEXT "Please select the application you wish to uninstall:",IDC_PLEASESELECT,10,10,250,14 + EDITTEXT IDC_FILTER,10,25,250,14,ES_AUTOHSCROLL LISTBOX IDC_LIST,10,43,250,106,LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "&Uninstall",IDC_UNINSTALL,270,48,50,14 @@ -37,7 +38,7 @@ END STRINGTABLE DISCARDABLE { IDS_APPNAME, "Wine Application Unsinstaller" IDS_ABOUT, "Wine Application Uninstaller (C) 2005 by Andreas Mohr, Hannu Valtonen and Jonathan Ernst." - IDS_ABOUTTITLE, "About Unsinstaller" + IDS_ABOUTTITLE, "About Uninstaller" IDS_REGISTRYKEYNOTAVAILABLE, "Uninstall registry key not available (yet), nothing to do !" IDS_UNINSTALLFAILED, "Execution of uninstall command '%s' failed, perhaps due to missing executable.\r\nDo you want to remove the uninstall entry from the registry ?" } diff --git a/programs/uninstaller/Makefile.in b/programs/uninstaller/Makefile.in index 8ce7b9c38ae..f7a7403f50e 100644 --- a/programs/uninstaller/Makefile.in +++ b/programs/uninstaller/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = uninstaller.exe APPMODE = -mconsole -IMPORTS = user32 gdi32 advapi32 kernel32 +IMPORTS = shlwapi user32 gdi32 advapi32 kernel32 C_SRCS = \ main.c diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c index 458a1c3c434..d91426f7e71 100644 --- a/programs/uninstaller/main.c +++ b/programs/uninstaller/main.c @@ -19,15 +19,13 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * ToDo: - * - add search box for locating entries quickly */ #include #include #include -#include #include +#include #include "resource.h" #include "regstr.h" #include "wine/debug.h" @@ -44,6 +42,7 @@ static uninst_entry *entries = NULL; static unsigned int numentries = 0; static int list_need_update = 1; static int oldsel = -1; +static WCHAR *sFilter; static WCHAR sAppName[MAX_STRING_LEN]; static WCHAR sAboutTitle[MAX_STRING_LEN]; static WCHAR sAbout[MAX_STRING_LEN]; @@ -67,6 +66,7 @@ static const WCHAR PathUninstallW[] = { 'U','n','i','n','s','t','a','l','l',0 }; static const WCHAR UninstallCommandlineW[] = {'U','n','i','n','s','t','a','l','l','S','t','r','i','n','g',0}; + /** * Used to output program list when used with --list */ @@ -228,6 +228,8 @@ static int FetchUninstallInformation(void) RegQueryValueExW(hkeyApp, UninstallCommandlineW, 0, 0, (LPBYTE)entries[numentries-1].command, &uninstlen); WINE_TRACE("allocated entry #%d: %s (%s), %s\n", numentries, wine_dbgstr_w(entries[numentries-1].key), wine_dbgstr_w(entries[numentries-1].descr), wine_dbgstr_w(entries[numentries-1].command)); + if(sFilter != NULL && StrStrIW(entries[numentries-1].descr,sFilter)==NULL) + numentries--; } RegCloseKey(hkeyApp); sizeOfSubKeyName = 255; @@ -295,6 +297,22 @@ static INT_PTR CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l case WM_COMMAND: switch(LOWORD(wParam)) { + case IDC_FILTER: + { + if (HIWORD(wParam) == EN_CHANGE) + { + int len = GetWindowTextLengthW(GetDlgItem(hwnd, IDC_FILTER)); + list_need_update = 1; + if(len > 0) + { + sFilter = (WCHAR*)GlobalAlloc(GPTR, (len + 1)*sizeof(WCHAR)); + GetDlgItemTextW(hwnd, IDC_FILTER, sFilter, (len + 1)*sizeof(WCHAR)); + } + else sFilter = NULL; + UpdateList(hList); + } + break; + } case IDC_UNINSTALL: { int count = SendMessageW(hList, LB_GETSELCOUNT, 0, 0); diff --git a/programs/uninstaller/rsrc.rc b/programs/uninstaller/rsrc.rc index ef7ecaff15a..15081531e00 100644 --- a/programs/uninstaller/rsrc.rc +++ b/programs/uninstaller/rsrc.rc @@ -1,7 +1,7 @@ /* * Uninstaller (rsrc.rc) * - * Copyright 2000 Andreas Mohr + * Copyright 2000 Andreas Mohr * Copyright 2003 Vincent Béron * Copyright 2003 Ivan Leo Puoti * Copyright 2004 David Kredba