diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2012-05-08 15:42:54 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-09-28 10:40:18 +0200 |
commit | 7a3f15d5892a5d6b4b6805ba3e5b5b7c2fc0f59b (patch) | |
tree | ba2fe7473e95497b206f2623d1fec88980870150 /fpicker | |
parent | 1a8ba3e16e437a9d4b1061a8ec98af8260717936 (diff) |
novell-win32-xp-fpicker-detail.diff, bnc#620924
make it possible to set file open dialog default to "details" on XP
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/win32/filepicker/FileOpenDlg.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.cxx b/fpicker/source/win32/filepicker/FileOpenDlg.cxx index 9d88ed40228c..be31db09dfcd 100644 --- a/fpicker/source/win32/filepicker/FileOpenDlg.cxx +++ b/fpicker/source/win32/filepicker/FileOpenDlg.cxx @@ -550,6 +550,13 @@ void SAL_CALL CFileOpenDialog::handleInitDialog(HWND hwndDlg, HWND hwndChild) //------------------------------------------------------------------------ // //------------------------------------------------------------------------ +#ifndef ODM_VIEW_DETAIL + +// Reverse-engineered command codes for SHELLDLL_DefView +// See http://msdn.microsoft.com/en-us/magazine/cc164009.aspx +#define ODM_VIEW_DETAIL 0x702c + +#endif UINT_PTR CALLBACK CFileOpenDialog::ofnHookProc( HWND hChildDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) @@ -557,6 +564,10 @@ UINT_PTR CALLBACK CFileOpenDialog::ofnHookProc( HWND hwndDlg = GetParent(hChildDlg); CFileOpenDialog* pImpl = NULL; + static bool set_view_details = false; + static bool view_was_set = false; + + switch( uiMsg ) { case WM_INITDIALOG: @@ -575,11 +586,39 @@ UINT_PTR CALLBACK CFileOpenDialog::ofnHookProc( // connect the instance handle to the window SetProp(hwndDlg, CURRENT_INSTANCE, pImpl); pImpl->handleInitDialog(hwndDlg, hChildDlg); + + static bool beenhere = false; + + if (!beenhere) + { + HKEY hkey; + beenhere = true; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, + L"Software\\Novell\\OpenOffice.org", + 0, KEY_READ, &hkey) == ERROR_SUCCESS) + { + if (RegQueryValueEx(hkey, L"FileOpenUseDetailsViewByDefault", + NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + set_view_details = true; + RegCloseKey(hkey); + } + } + view_was_set = false; } return 0; case WM_NOTIFY: { + if (set_view_details && !view_was_set) + { + // See http://msdn.microsoft.com/en-us/magazine/cc164009.aspx + HWND shell = GetDlgItem(hwndDlg, lst2); + if (shell != NULL) + { + SendMessage (shell, WM_COMMAND, ODM_VIEW_DETAIL, 0); + view_was_set = true; + } + } pImpl = getCurrentInstance(hwndDlg); return pImpl->onWMNotify( hChildDlg, reinterpret_cast<LPOFNOTIFY>(lParam)); |