[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - fpicker/source

Tor Lillqvist tlillqvist at suse.com
Tue Apr 2 14:15:12 PDT 2013


 fpicker/source/win32/filepicker/FileOpenDlg.cxx |   39 ++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

New commits:
commit 22d2ec9cd84292e06496470906694f693f9ebe1a
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue May 8 15:42:54 2012 +0200

    novell-win32-xp-fpicker-detail.diff, bnc#620924
    
    make it possible to set file open dialog default to "details" on XP

diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.cxx b/fpicker/source/win32/filepicker/FileOpenDlg.cxx
index 6397a25..eef2d16 100644
--- a/fpicker/source/win32/filepicker/FileOpenDlg.cxx
+++ b/fpicker/source/win32/filepicker/FileOpenDlg.cxx
@@ -536,6 +536,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)
@@ -543,6 +550,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:
@@ -561,11 +572,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));


More information about the Libreoffice-commits mailing list